79 lines
1.9 KiB
Dart
79 lines
1.9 KiB
Dart
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
|
|
part of angel_orm_generator.test.models.user;
|
|
|
|
// **************************************************************************
|
|
// Generator: JsonModelGenerator
|
|
// **************************************************************************
|
|
|
|
class User extends _User {
|
|
@override
|
|
String id;
|
|
|
|
@override
|
|
String username;
|
|
|
|
@override
|
|
String password;
|
|
|
|
@override
|
|
String email;
|
|
|
|
@override
|
|
List<Role> roles;
|
|
|
|
@override
|
|
DateTime createdAt;
|
|
|
|
@override
|
|
DateTime updatedAt;
|
|
|
|
User(
|
|
{this.id,
|
|
this.username,
|
|
this.password,
|
|
this.email,
|
|
this.roles,
|
|
this.createdAt,
|
|
this.updatedAt});
|
|
|
|
factory User.fromJson(Map data) {
|
|
return new User(
|
|
id: data['id'],
|
|
username: data['username'],
|
|
password: data['password'],
|
|
email: data['email'],
|
|
roles: data['roles'] is List
|
|
? data['roles']
|
|
.map((x) =>
|
|
x == null ? null : (x is Role ? x : new Role.fromJson(x)))
|
|
.toList()
|
|
: null,
|
|
createdAt: data['created_at'] is DateTime
|
|
? data['created_at']
|
|
: (data['created_at'] is String
|
|
? DateTime.parse(data['created_at'])
|
|
: null),
|
|
updatedAt: data['updated_at'] is DateTime
|
|
? data['updated_at']
|
|
: (data['updated_at'] is String
|
|
? DateTime.parse(data['updated_at'])
|
|
: null));
|
|
}
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'id': id,
|
|
'username': username,
|
|
'password': password,
|
|
'email': email,
|
|
'roles': roles,
|
|
'created_at': createdAt == null ? null : createdAt.toIso8601String(),
|
|
'updated_at': updatedAt == null ? null : updatedAt.toIso8601String()
|
|
};
|
|
|
|
static User parse(Map map) => new User.fromJson(map);
|
|
|
|
User clone() {
|
|
return new User.fromJson(toJson());
|
|
}
|
|
}
|