2017-07-15 20:18:53 +00:00
|
|
|
library angel_orm_generator.test.models.user;
|
|
|
|
|
2018-12-09 17:44:16 +00:00
|
|
|
import 'package:angel_migration/angel_migration.dart';
|
2017-07-15 20:18:53 +00:00
|
|
|
import 'package:angel_model/angel_model.dart';
|
|
|
|
import 'package:angel_orm/angel_orm.dart';
|
|
|
|
import 'package:angel_serialize/angel_serialize.dart';
|
2018-12-03 13:41:14 +00:00
|
|
|
import 'package:collection/collection.dart';
|
2017-07-15 20:18:53 +00:00
|
|
|
part 'user.g.dart';
|
|
|
|
|
|
|
|
@serializable
|
2018-12-01 19:03:43 +00:00
|
|
|
@orm
|
2018-12-08 22:51:27 +00:00
|
|
|
abstract class _User extends Model {
|
|
|
|
String get username;
|
|
|
|
String get password;
|
|
|
|
String get email;
|
2017-07-15 20:18:53 +00:00
|
|
|
|
2019-04-02 23:05:13 +00:00
|
|
|
@ManyToMany(_RoleUser)
|
2019-01-07 18:22:12 +00:00
|
|
|
List<_Role> get roles;
|
2018-12-08 22:51:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@serializable
|
|
|
|
@orm
|
2019-04-02 23:05:13 +00:00
|
|
|
abstract class _RoleUser {
|
2019-01-07 18:22:12 +00:00
|
|
|
@belongsTo
|
|
|
|
_Role get role;
|
2018-12-08 23:13:10 +00:00
|
|
|
|
2019-01-07 18:22:12 +00:00
|
|
|
@belongsTo
|
|
|
|
_User get user;
|
2018-12-08 22:51:27 +00:00
|
|
|
}
|
|
|
|
|
2019-01-07 18:22:12 +00:00
|
|
|
@serializable
|
2018-12-08 22:51:27 +00:00
|
|
|
@orm
|
2019-01-07 18:22:12 +00:00
|
|
|
abstract class _Role extends Model {
|
|
|
|
String name;
|
2018-12-08 22:51:27 +00:00
|
|
|
|
2019-04-02 23:05:13 +00:00
|
|
|
@ManyToMany(_RoleUser)
|
2019-01-07 18:22:12 +00:00
|
|
|
List<_User> get users;
|
2018-12-03 13:41:14 +00:00
|
|
|
}
|