2017-07-06 20:14:26 +00:00
|
|
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
|
|
|
2017-07-15 20:18:53 +00:00
|
|
|
part of angel_orm.generator.models.book;
|
2017-07-06 20:14:26 +00:00
|
|
|
|
|
|
|
// **************************************************************************
|
|
|
|
// Generator: JsonModelGenerator
|
|
|
|
// **************************************************************************
|
|
|
|
|
|
|
|
class Book extends _Book {
|
|
|
|
@override
|
|
|
|
String id;
|
|
|
|
|
|
|
|
@override
|
2017-09-15 19:23:36 +00:00
|
|
|
Author author;
|
|
|
|
|
|
|
|
@override
|
|
|
|
int authorId;
|
2017-07-06 20:14:26 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
String name;
|
|
|
|
|
|
|
|
@override
|
|
|
|
DateTime createdAt;
|
|
|
|
|
|
|
|
@override
|
|
|
|
DateTime updatedAt;
|
|
|
|
|
2017-09-15 19:23:36 +00:00
|
|
|
Book(
|
|
|
|
{this.id,
|
|
|
|
this.author,
|
|
|
|
this.authorId,
|
|
|
|
this.name,
|
|
|
|
this.createdAt,
|
|
|
|
this.updatedAt});
|
2017-07-06 20:14:26 +00:00
|
|
|
|
|
|
|
factory Book.fromJson(Map data) {
|
|
|
|
return new Book(
|
|
|
|
id: data['id'],
|
2017-09-15 19:23:36 +00:00
|
|
|
author: data['author'] == null
|
|
|
|
? null
|
|
|
|
: (data['author'] is Author
|
|
|
|
? data['author']
|
|
|
|
: new Author.fromJson(data['author'])),
|
|
|
|
authorId: data['author_id'],
|
2017-07-06 20:14:26 +00:00
|
|
|
name: data['name'],
|
|
|
|
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,
|
|
|
|
'author': author,
|
2017-09-15 19:23:36 +00:00
|
|
|
'author_id': authorId,
|
2017-07-06 20:14:26 +00:00
|
|
|
'name': name,
|
|
|
|
'created_at': createdAt == null ? null : createdAt.toIso8601String(),
|
|
|
|
'updated_at': updatedAt == null ? null : updatedAt.toIso8601String()
|
|
|
|
};
|
|
|
|
|
|
|
|
static Book parse(Map map) => new Book.fromJson(map);
|
2017-07-10 21:49:00 +00:00
|
|
|
|
|
|
|
Book clone() {
|
|
|
|
return new Book.fromJson(toJson());
|
|
|
|
}
|
2017-07-06 20:14:26 +00:00
|
|
|
}
|