platform/angel_serialize_generator/test/models/author.dart

42 lines
825 B
Dart
Raw Normal View History

2017-12-07 07:08:32 +00:00
library angel_serialize.test.models.author;
import 'package:angel_framework/common.dart';
import 'package:angel_serialize/angel_serialize.dart';
2018-05-13 18:02:47 +00:00
import 'package:collection/collection.dart';
2017-12-07 07:08:32 +00:00
import 'book.dart';
2018-03-29 19:58:36 +00:00
2017-12-07 07:08:32 +00:00
part 'author.g.dart';
2018-03-29 19:58:36 +00:00
2018-02-28 01:10:57 +00:00
part 'author.serializer.g.dart';
2017-12-07 07:08:32 +00:00
@serializable
abstract class _Author extends Model {
2018-05-13 16:50:59 +00:00
String get name;
int get age;
List<Book> get books;
Book get newestBook;
2017-12-07 07:08:32 +00:00
@exclude
2018-05-13 16:50:59 +00:00
String get secret;
@Exclude(canDeserialize: true)
2018-05-13 16:50:59 +00:00
String get obscured;
2017-12-07 07:08:32 +00:00
}
2018-03-29 19:58:36 +00:00
@Serializable(serializers: Serializers.all)
2017-12-07 07:08:32 +00:00
abstract class _Library extends Model {
2018-05-13 16:50:59 +00:00
Map<String, Book> get collection;
2018-02-28 00:36:53 +00:00
}
2018-05-13 17:23:40 +00:00
2018-05-13 18:02:47 +00:00
@Serializable(serializers: Serializers.all)
2018-05-13 17:23:40 +00:00
abstract class _Bookmark extends Model {
@exclude
final Book book;
2018-05-13 18:02:47 +00:00
List<int> get history;
2018-05-13 17:23:40 +00:00
int get page;
String get comment;
2018-05-13 18:02:47 +00:00
2018-05-13 17:23:40 +00:00
_Bookmark(this.book);
}