2018-02-28 00:59:43 +00:00
|
|
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
|
|
|
|
|
|
part of angel_serialize.test.models.author;
|
|
|
|
|
|
|
|
// **************************************************************************
|
|
|
|
// Generator: SerializerGenerator
|
|
|
|
// **************************************************************************
|
|
|
|
|
2018-02-28 01:10:57 +00:00
|
|
|
abstract class AuthorSerializer {
|
2018-03-09 12:45:03 +00:00
|
|
|
static Author fromMap(Map map) {
|
2018-02-28 02:10:43 +00:00
|
|
|
return new Author(
|
|
|
|
id: map['id'],
|
|
|
|
name: map['name'],
|
|
|
|
age: map['age'],
|
|
|
|
books: map['books'] is Iterable
|
|
|
|
? map['books'].map(BookSerializer.fromMap).toList()
|
|
|
|
: null,
|
|
|
|
newestBook: map['newest_book'] != null
|
|
|
|
? BookSerializer.fromMap(map['newest_book'])
|
|
|
|
: null,
|
2018-03-02 18:38:41 +00:00
|
|
|
obscured: map['obscured'],
|
2018-02-28 02:10:43 +00:00
|
|
|
createdAt: map['created_at'] != null
|
2018-03-30 18:53:38 +00:00
|
|
|
? (map['created_at'] is DateTime
|
|
|
|
? map['created_at']
|
|
|
|
: DateTime.parse(map['created_at']))
|
2018-02-28 02:10:43 +00:00
|
|
|
: null,
|
|
|
|
updatedAt: map['updated_at'] != null
|
2018-03-30 18:53:38 +00:00
|
|
|
? (map['updated_at'] is DateTime
|
|
|
|
? map['updated_at']
|
|
|
|
: DateTime.parse(map['updated_at']))
|
2018-02-28 02:10:43 +00:00
|
|
|
: null);
|
|
|
|
}
|
|
|
|
|
2018-02-28 01:41:19 +00:00
|
|
|
static Map<String, dynamic> toMap(Author model) {
|
2018-02-28 01:10:57 +00:00
|
|
|
return {
|
2018-02-28 01:41:19 +00:00
|
|
|
'id': model.id,
|
|
|
|
'name': model.name,
|
|
|
|
'age': model.age,
|
2018-02-28 02:10:43 +00:00
|
|
|
'books': model.books?.map(BookSerializer.toMap)?.toList(),
|
2018-02-28 01:41:19 +00:00
|
|
|
'newest_book': BookSerializer.toMap(model.newestBook),
|
2018-02-28 02:10:43 +00:00
|
|
|
'created_at': model.createdAt?.toIso8601String(),
|
|
|
|
'updated_at': model.updatedAt?.toIso8601String()
|
2018-02-28 01:10:57 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
2018-02-28 00:59:43 +00:00
|
|
|
|
2018-03-09 12:39:21 +00:00
|
|
|
abstract class AuthorFields {
|
|
|
|
static const String id = 'id';
|
|
|
|
|
|
|
|
static const String name = 'name';
|
|
|
|
|
|
|
|
static const String age = 'age';
|
|
|
|
|
|
|
|
static const String books = 'books';
|
|
|
|
|
|
|
|
static const String newestBook = 'newest_book';
|
|
|
|
|
|
|
|
static const String secret = 'secret';
|
|
|
|
|
|
|
|
static const String obscured = 'obscured';
|
|
|
|
|
|
|
|
static const String createdAt = 'created_at';
|
|
|
|
|
|
|
|
static const String updatedAt = 'updated_at';
|
|
|
|
}
|
|
|
|
|
2018-02-28 01:10:57 +00:00
|
|
|
abstract class LibrarySerializer {
|
2018-03-09 12:45:03 +00:00
|
|
|
static Library fromMap(Map map) {
|
2018-02-28 02:10:43 +00:00
|
|
|
return new Library(
|
|
|
|
id: map['id'],
|
|
|
|
collection: map['collection'] is Map
|
|
|
|
? map['collection'].keys.fold({}, (out, key) {
|
|
|
|
return out
|
|
|
|
..[key] = BookSerializer.fromMap(map['collection'][key]);
|
|
|
|
})
|
|
|
|
: null,
|
|
|
|
createdAt: map['created_at'] != null
|
2018-03-30 18:53:38 +00:00
|
|
|
? (map['created_at'] is DateTime
|
|
|
|
? map['created_at']
|
|
|
|
: DateTime.parse(map['created_at']))
|
2018-02-28 02:10:43 +00:00
|
|
|
: null,
|
|
|
|
updatedAt: map['updated_at'] != null
|
2018-03-30 18:53:38 +00:00
|
|
|
? (map['updated_at'] is DateTime
|
|
|
|
? map['updated_at']
|
|
|
|
: DateTime.parse(map['updated_at']))
|
2018-02-28 02:10:43 +00:00
|
|
|
: null);
|
|
|
|
}
|
|
|
|
|
2018-02-28 01:41:19 +00:00
|
|
|
static Map<String, dynamic> toMap(Library model) {
|
2018-02-28 01:10:57 +00:00
|
|
|
return {
|
2018-02-28 01:41:19 +00:00
|
|
|
'id': model.id,
|
2018-02-28 02:10:43 +00:00
|
|
|
'collection': model.collection.keys?.fold({}, (map, key) {
|
2018-02-28 01:43:43 +00:00
|
|
|
return map..[key] = BookSerializer.toMap(model.collection[key]);
|
|
|
|
}),
|
2018-02-28 02:10:43 +00:00
|
|
|
'created_at': model.createdAt?.toIso8601String(),
|
|
|
|
'updated_at': model.updatedAt?.toIso8601String()
|
2018-02-28 01:10:57 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
2018-03-09 12:39:21 +00:00
|
|
|
|
|
|
|
abstract class LibraryFields {
|
|
|
|
static const String id = 'id';
|
|
|
|
|
|
|
|
static const String collection = 'collection';
|
|
|
|
|
|
|
|
static const String createdAt = 'created_at';
|
|
|
|
|
|
|
|
static const String updatedAt = 'updated_at';
|
|
|
|
}
|
2018-05-13 17:23:40 +00:00
|
|
|
|
|
|
|
abstract class BookmarkSerializer {
|
|
|
|
static Bookmark fromMap(Map map, Book book) {
|
|
|
|
return new Bookmark(book,
|
|
|
|
id: map['id'],
|
|
|
|
page: map['page'],
|
|
|
|
comment: map['comment'],
|
|
|
|
createdAt: map['created_at'] != null
|
|
|
|
? (map['created_at'] is DateTime
|
|
|
|
? map['created_at']
|
|
|
|
: DateTime.parse(map['created_at']))
|
|
|
|
: null,
|
|
|
|
updatedAt: map['updated_at'] != null
|
|
|
|
? (map['updated_at'] is DateTime
|
|
|
|
? map['updated_at']
|
|
|
|
: DateTime.parse(map['updated_at']))
|
|
|
|
: null);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Map<String, dynamic> toMap(Bookmark model) {
|
|
|
|
return {
|
|
|
|
'id': model.id,
|
|
|
|
'page': model.page,
|
|
|
|
'comment': model.comment,
|
|
|
|
'created_at': model.createdAt?.toIso8601String(),
|
|
|
|
'updated_at': model.updatedAt?.toIso8601String()
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
abstract class BookmarkFields {
|
|
|
|
static const String id = 'id';
|
|
|
|
|
|
|
|
static const String page = 'page';
|
|
|
|
|
|
|
|
static const String comment = 'comment';
|
|
|
|
|
|
|
|
static const String createdAt = 'created_at';
|
|
|
|
|
|
|
|
static const String updatedAt = 'updated_at';
|
|
|
|
}
|