Updated models
This commit is contained in:
parent
f86c647360
commit
97e146a80e
11 changed files with 32 additions and 434 deletions
|
@ -189,10 +189,6 @@ class Author extends _Author {
|
|||
|
||||
abstract class AuthorSerializer {
|
||||
static Author fromMap(Map map) {
|
||||
if (map['name'] == null) {
|
||||
throw new FormatException("Missing required field 'name' on Author.");
|
||||
}
|
||||
|
||||
return new Author(
|
||||
id: map['id'] as String,
|
||||
name: map['name'] as String ?? 'Tobe Osakwe',
|
||||
|
@ -212,10 +208,6 @@ abstract class AuthorSerializer {
|
|||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
if (model.name == null) {
|
||||
throw new FormatException("Missing required field 'name' on Author.");
|
||||
}
|
||||
|
||||
return {
|
||||
'id': model.id,
|
||||
'name': model.name,
|
||||
|
|
|
@ -188,9 +188,9 @@ class BookQueryValues extends MapQueryValues {
|
|||
class Book extends _Book {
|
||||
Book(
|
||||
{this.id,
|
||||
@required this.author,
|
||||
@required this.partnerAuthor,
|
||||
@required this.name,
|
||||
this.author,
|
||||
this.partnerAuthor,
|
||||
this.name,
|
||||
this.createdAt,
|
||||
this.updatedAt});
|
||||
|
||||
|
@ -254,19 +254,6 @@ class Book extends _Book {
|
|||
|
||||
abstract class BookSerializer {
|
||||
static Book fromMap(Map map) {
|
||||
if (map['author'] == null) {
|
||||
throw new FormatException("Missing required field 'author' on Book.");
|
||||
}
|
||||
|
||||
if (map['partner_author'] == null) {
|
||||
throw new FormatException(
|
||||
"Missing required field 'partner_author' on Book.");
|
||||
}
|
||||
|
||||
if (map['name'] == null) {
|
||||
throw new FormatException("Missing required field 'name' on Book.");
|
||||
}
|
||||
|
||||
return new Book(
|
||||
id: map['id'] as String,
|
||||
author: map['author'] != null
|
||||
|
@ -292,19 +279,6 @@ abstract class BookSerializer {
|
|||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
if (model.author == null) {
|
||||
throw new FormatException("Missing required field 'author' on Book.");
|
||||
}
|
||||
|
||||
if (model.partnerAuthor == null) {
|
||||
throw new FormatException(
|
||||
"Missing required field 'partner_author' on Book.");
|
||||
}
|
||||
|
||||
if (model.name == null) {
|
||||
throw new FormatException("Missing required field 'name' on Book.");
|
||||
}
|
||||
|
||||
return {
|
||||
'id': model.id,
|
||||
'author': AuthorSerializer.toMap(model.author),
|
||||
|
|
|
@ -191,10 +191,10 @@ class CarQueryValues extends MapQueryValues {
|
|||
class Car extends _Car {
|
||||
Car(
|
||||
{this.id,
|
||||
@required this.make,
|
||||
@required this.description,
|
||||
@required this.familyFriendly,
|
||||
@required this.recalledAt,
|
||||
this.make,
|
||||
this.description,
|
||||
this.familyFriendly,
|
||||
this.recalledAt,
|
||||
this.createdAt,
|
||||
this.updatedAt});
|
||||
|
||||
|
@ -272,23 +272,6 @@ class Car extends _Car {
|
|||
|
||||
abstract class CarSerializer {
|
||||
static Car fromMap(Map map) {
|
||||
if (map['make'] == null) {
|
||||
throw new FormatException("Missing required field 'make' on Car.");
|
||||
}
|
||||
|
||||
if (map['description'] == null) {
|
||||
throw new FormatException("Missing required field 'description' on Car.");
|
||||
}
|
||||
|
||||
if (map['family_friendly'] == null) {
|
||||
throw new FormatException(
|
||||
"Missing required field 'family_friendly' on Car.");
|
||||
}
|
||||
|
||||
if (map['recalled_at'] == null) {
|
||||
throw new FormatException("Missing required field 'recalled_at' on Car.");
|
||||
}
|
||||
|
||||
return new Car(
|
||||
id: map['id'] as String,
|
||||
make: map['make'] as String,
|
||||
|
@ -315,23 +298,6 @@ abstract class CarSerializer {
|
|||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
if (model.make == null) {
|
||||
throw new FormatException("Missing required field 'make' on Car.");
|
||||
}
|
||||
|
||||
if (model.description == null) {
|
||||
throw new FormatException("Missing required field 'description' on Car.");
|
||||
}
|
||||
|
||||
if (model.familyFriendly == null) {
|
||||
throw new FormatException(
|
||||
"Missing required field 'family_friendly' on Car.");
|
||||
}
|
||||
|
||||
if (model.recalledAt == null) {
|
||||
throw new FormatException("Missing required field 'recalled_at' on Car.");
|
||||
}
|
||||
|
||||
return {
|
||||
'id': model.id,
|
||||
'make': model.make,
|
||||
|
|
|
@ -151,12 +151,7 @@ class FootQueryValues extends MapQueryValues {
|
|||
|
||||
@generatedSerializable
|
||||
class Foot extends _Foot {
|
||||
Foot(
|
||||
{this.id,
|
||||
@required this.legId,
|
||||
@required this.nToes,
|
||||
this.createdAt,
|
||||
this.updatedAt});
|
||||
Foot({this.id, this.legId, this.nToes, this.createdAt, this.updatedAt});
|
||||
|
||||
@override
|
||||
final String id;
|
||||
|
@ -212,14 +207,6 @@ class Foot extends _Foot {
|
|||
|
||||
abstract class FootSerializer {
|
||||
static Foot fromMap(Map map) {
|
||||
if (map['leg_id'] == null) {
|
||||
throw new FormatException("Missing required field 'leg_id' on Foot.");
|
||||
}
|
||||
|
||||
if (map['n_toes'] == null) {
|
||||
throw new FormatException("Missing required field 'n_toes' on Foot.");
|
||||
}
|
||||
|
||||
return new Foot(
|
||||
id: map['id'] as String,
|
||||
legId: map['leg_id'] as int,
|
||||
|
@ -240,14 +227,6 @@ abstract class FootSerializer {
|
|||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
if (model.legId == null) {
|
||||
throw new FormatException("Missing required field 'leg_id' on Foot.");
|
||||
}
|
||||
|
||||
if (model.nToes == null) {
|
||||
throw new FormatException("Missing required field 'n_toes' on Foot.");
|
||||
}
|
||||
|
||||
return {
|
||||
'id': model.id,
|
||||
'leg_id': model.legId,
|
||||
|
|
|
@ -152,11 +152,7 @@ class FruitQueryValues extends MapQueryValues {
|
|||
@generatedSerializable
|
||||
class Fruit extends _Fruit {
|
||||
Fruit(
|
||||
{this.id,
|
||||
@required this.treeId,
|
||||
@required this.commonName,
|
||||
this.createdAt,
|
||||
this.updatedAt});
|
||||
{this.id, this.treeId, this.commonName, this.createdAt, this.updatedAt});
|
||||
|
||||
@override
|
||||
final String id;
|
||||
|
@ -212,15 +208,6 @@ class Fruit extends _Fruit {
|
|||
|
||||
abstract class FruitSerializer {
|
||||
static Fruit fromMap(Map map) {
|
||||
if (map['tree_id'] == null) {
|
||||
throw new FormatException("Missing required field 'tree_id' on Fruit.");
|
||||
}
|
||||
|
||||
if (map['common_name'] == null) {
|
||||
throw new FormatException(
|
||||
"Missing required field 'common_name' on Fruit.");
|
||||
}
|
||||
|
||||
return new Fruit(
|
||||
id: map['id'] as String,
|
||||
treeId: map['tree_id'] as int,
|
||||
|
@ -241,15 +228,6 @@ abstract class FruitSerializer {
|
|||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
if (model.treeId == null) {
|
||||
throw new FormatException("Missing required field 'tree_id' on Fruit.");
|
||||
}
|
||||
|
||||
if (model.commonName == null) {
|
||||
throw new FormatException(
|
||||
"Missing required field 'common_name' on Fruit.");
|
||||
}
|
||||
|
||||
return {
|
||||
'id': model.id,
|
||||
'tree_id': model.treeId,
|
||||
|
|
|
@ -119,9 +119,7 @@ class HasMapQueryValues extends MapQueryValues {
|
|||
|
||||
@generatedSerializable
|
||||
class HasMap implements _HasMap {
|
||||
const HasMap(
|
||||
{@required Map<dynamic, dynamic> this.value,
|
||||
@required List<dynamic> this.list});
|
||||
const HasMap({Map<dynamic, dynamic> this.value, List<dynamic> this.list});
|
||||
|
||||
@override
|
||||
final Map<dynamic, dynamic> value;
|
||||
|
@ -158,14 +156,6 @@ class HasMap implements _HasMap {
|
|||
|
||||
abstract class HasMapSerializer {
|
||||
static HasMap fromMap(Map map) {
|
||||
if (map['value'] == null) {
|
||||
throw new FormatException("Missing required field 'value' on HasMap.");
|
||||
}
|
||||
|
||||
if (map['list'] == null) {
|
||||
throw new FormatException("Missing required field 'list' on HasMap.");
|
||||
}
|
||||
|
||||
return new HasMap(
|
||||
value: map['value'] is Map
|
||||
? (map['value'] as Map).cast<dynamic, dynamic>()
|
||||
|
@ -179,14 +169,6 @@ abstract class HasMapSerializer {
|
|||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
if (model.value == null) {
|
||||
throw new FormatException("Missing required field 'value' on HasMap.");
|
||||
}
|
||||
|
||||
if (model.list == null) {
|
||||
throw new FormatException("Missing required field 'list' on HasMap.");
|
||||
}
|
||||
|
||||
return {'value': model.value, 'list': model.list};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -152,12 +152,7 @@ class LegQueryValues extends MapQueryValues {
|
|||
|
||||
@generatedSerializable
|
||||
class Leg extends _Leg {
|
||||
Leg(
|
||||
{this.id,
|
||||
@required this.foot,
|
||||
@required this.name,
|
||||
this.createdAt,
|
||||
this.updatedAt});
|
||||
Leg({this.id, this.foot, this.name, this.createdAt, this.updatedAt});
|
||||
|
||||
@override
|
||||
final String id;
|
||||
|
@ -213,14 +208,6 @@ class Leg extends _Leg {
|
|||
|
||||
abstract class LegSerializer {
|
||||
static Leg fromMap(Map map) {
|
||||
if (map['foot'] == null) {
|
||||
throw new FormatException("Missing required field 'foot' on Leg.");
|
||||
}
|
||||
|
||||
if (map['name'] == null) {
|
||||
throw new FormatException("Missing required field 'name' on Leg.");
|
||||
}
|
||||
|
||||
return new Leg(
|
||||
id: map['id'] as String,
|
||||
foot: map['foot'] != null
|
||||
|
@ -243,14 +230,6 @@ abstract class LegSerializer {
|
|||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
if (model.foot == null) {
|
||||
throw new FormatException("Missing required field 'foot' on Leg.");
|
||||
}
|
||||
|
||||
if (model.name == null) {
|
||||
throw new FormatException("Missing required field 'name' on Leg.");
|
||||
}
|
||||
|
||||
return {
|
||||
'id': model.id,
|
||||
'foot': FootSerializer.toMap(model.foot),
|
||||
|
|
|
@ -199,10 +199,10 @@ class OrderQueryValues extends MapQueryValues {
|
|||
class Order extends _Order {
|
||||
Order(
|
||||
{this.id,
|
||||
@required this.customer,
|
||||
@required this.employeeId,
|
||||
@required this.orderDate,
|
||||
@required this.shipperId,
|
||||
this.customer,
|
||||
this.employeeId,
|
||||
this.orderDate,
|
||||
this.shipperId,
|
||||
this.createdAt,
|
||||
this.updatedAt});
|
||||
|
||||
|
@ -273,25 +273,6 @@ class Order extends _Order {
|
|||
|
||||
abstract class OrderSerializer {
|
||||
static Order fromMap(Map map) {
|
||||
if (map['customer'] == null) {
|
||||
throw new FormatException("Missing required field 'customer' on Order.");
|
||||
}
|
||||
|
||||
if (map['employee_id'] == null) {
|
||||
throw new FormatException(
|
||||
"Missing required field 'employee_id' on Order.");
|
||||
}
|
||||
|
||||
if (map['order_date'] == null) {
|
||||
throw new FormatException(
|
||||
"Missing required field 'order_date' on Order.");
|
||||
}
|
||||
|
||||
if (map['shipper_id'] == null) {
|
||||
throw new FormatException(
|
||||
"Missing required field 'shipper_id' on Order.");
|
||||
}
|
||||
|
||||
return new Order(
|
||||
id: map['id'] as String,
|
||||
customer: map['customer'] != null
|
||||
|
@ -320,25 +301,6 @@ abstract class OrderSerializer {
|
|||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
if (model.customer == null) {
|
||||
throw new FormatException("Missing required field 'customer' on Order.");
|
||||
}
|
||||
|
||||
if (model.employeeId == null) {
|
||||
throw new FormatException(
|
||||
"Missing required field 'employee_id' on Order.");
|
||||
}
|
||||
|
||||
if (model.orderDate == null) {
|
||||
throw new FormatException(
|
||||
"Missing required field 'order_date' on Order.");
|
||||
}
|
||||
|
||||
if (model.shipperId == null) {
|
||||
throw new FormatException(
|
||||
"Missing required field 'shipper_id' on Order.");
|
||||
}
|
||||
|
||||
return {
|
||||
'id': model.id,
|
||||
'customer': CustomerSerializer.toMap(model.customer),
|
||||
|
|
|
@ -213,11 +213,7 @@ class TreeQueryValues extends MapQueryValues {
|
|||
@generatedSerializable
|
||||
class Tree extends _Tree {
|
||||
Tree(
|
||||
{this.id,
|
||||
@required this.rings,
|
||||
@required List<Fruit> fruits,
|
||||
this.createdAt,
|
||||
this.updatedAt})
|
||||
{this.id, this.rings, List<Fruit> fruits, this.createdAt, this.updatedAt})
|
||||
: this.fruits = new List.unmodifiable(fruits ?? []);
|
||||
|
||||
@override
|
||||
|
@ -275,14 +271,6 @@ class Tree extends _Tree {
|
|||
|
||||
abstract class TreeSerializer {
|
||||
static Tree fromMap(Map map) {
|
||||
if (map['rings'] == null) {
|
||||
throw new FormatException("Missing required field 'rings' on Tree.");
|
||||
}
|
||||
|
||||
if (map['fruits'] == null) {
|
||||
throw new FormatException("Missing required field 'fruits' on Tree.");
|
||||
}
|
||||
|
||||
return new Tree(
|
||||
id: map['id'] as String,
|
||||
rings: map['rings'] as int,
|
||||
|
@ -308,14 +296,6 @@ abstract class TreeSerializer {
|
|||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
if (model.rings == null) {
|
||||
throw new FormatException("Missing required field 'rings' on Tree.");
|
||||
}
|
||||
|
||||
if (model.fruits == null) {
|
||||
throw new FormatException("Missing required field 'fruits' on Tree.");
|
||||
}
|
||||
|
||||
return {
|
||||
'id': model.id,
|
||||
'rings': model.rings,
|
||||
|
|
|
@ -821,7 +821,7 @@ class FooPivotQueryValues extends MapQueryValues {
|
|||
|
||||
@generatedSerializable
|
||||
class Unorthodox implements _Unorthodox {
|
||||
const Unorthodox({@required this.name});
|
||||
const Unorthodox({this.name});
|
||||
|
||||
@override
|
||||
final String name;
|
||||
|
@ -847,11 +847,11 @@ class Unorthodox implements _Unorthodox {
|
|||
@generatedSerializable
|
||||
class WeirdJoin implements _WeirdJoin {
|
||||
const WeirdJoin(
|
||||
{@required this.id,
|
||||
@required this.unorthodox,
|
||||
@required this.song,
|
||||
@required List<_Numba> this.numbas,
|
||||
@required List<_Foo> this.foos});
|
||||
{this.id,
|
||||
this.unorthodox,
|
||||
this.song,
|
||||
List<_Numba> this.numbas,
|
||||
List<_Foo> this.foos});
|
||||
|
||||
@override
|
||||
final int id;
|
||||
|
@ -905,12 +905,7 @@ class WeirdJoin implements _WeirdJoin {
|
|||
|
||||
@generatedSerializable
|
||||
class Song extends _Song {
|
||||
Song(
|
||||
{this.id,
|
||||
@required this.weirdJoinId,
|
||||
@required this.title,
|
||||
this.createdAt,
|
||||
this.updatedAt});
|
||||
Song({this.id, this.weirdJoinId, this.title, this.createdAt, this.updatedAt});
|
||||
|
||||
@override
|
||||
final String id;
|
||||
|
@ -962,7 +957,7 @@ class Song extends _Song {
|
|||
|
||||
@generatedSerializable
|
||||
class Numba extends _Numba {
|
||||
Numba({@required this.i, @required this.parent});
|
||||
Numba({this.i, this.parent});
|
||||
|
||||
@override
|
||||
final int i;
|
||||
|
@ -990,7 +985,7 @@ class Numba extends _Numba {
|
|||
|
||||
@generatedSerializable
|
||||
class Foo implements _Foo {
|
||||
const Foo({@required this.bar, @required List<_WeirdJoin> this.weirdJoins});
|
||||
const Foo({this.bar, List<_WeirdJoin> this.weirdJoins});
|
||||
|
||||
@override
|
||||
final String bar;
|
||||
|
@ -1022,7 +1017,7 @@ class Foo implements _Foo {
|
|||
|
||||
@generatedSerializable
|
||||
class FooPivot implements _FooPivot {
|
||||
const FooPivot({@required this.weirdJoin, @required this.foo});
|
||||
const FooPivot({this.weirdJoin, this.foo});
|
||||
|
||||
@override
|
||||
final _WeirdJoin weirdJoin;
|
||||
|
@ -1057,10 +1052,6 @@ class FooPivot implements _FooPivot {
|
|||
|
||||
abstract class UnorthodoxSerializer {
|
||||
static Unorthodox fromMap(Map map) {
|
||||
if (map['name'] == null) {
|
||||
throw new FormatException("Missing required field 'name' on Unorthodox.");
|
||||
}
|
||||
|
||||
return new Unorthodox(name: map['name'] as String);
|
||||
}
|
||||
|
||||
|
@ -1068,10 +1059,6 @@ abstract class UnorthodoxSerializer {
|
|||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
if (model.name == null) {
|
||||
throw new FormatException("Missing required field 'name' on Unorthodox.");
|
||||
}
|
||||
|
||||
return {'name': model.name};
|
||||
}
|
||||
}
|
||||
|
@ -1084,28 +1071,6 @@ abstract class UnorthodoxFields {
|
|||
|
||||
abstract class WeirdJoinSerializer {
|
||||
static WeirdJoin fromMap(Map map) {
|
||||
if (map['id'] == null) {
|
||||
throw new FormatException("Missing required field 'id' on WeirdJoin.");
|
||||
}
|
||||
|
||||
if (map['unorthodox'] == null) {
|
||||
throw new FormatException(
|
||||
"Missing required field 'unorthodox' on WeirdJoin.");
|
||||
}
|
||||
|
||||
if (map['song'] == null) {
|
||||
throw new FormatException("Missing required field 'song' on WeirdJoin.");
|
||||
}
|
||||
|
||||
if (map['numbas'] == null) {
|
||||
throw new FormatException(
|
||||
"Missing required field 'numbas' on WeirdJoin.");
|
||||
}
|
||||
|
||||
if (map['foos'] == null) {
|
||||
throw new FormatException("Missing required field 'foos' on WeirdJoin.");
|
||||
}
|
||||
|
||||
return new WeirdJoin(
|
||||
id: map['id'] as int,
|
||||
unorthodox: map['unorthodox'] != null
|
||||
|
@ -1132,28 +1097,6 @@ abstract class WeirdJoinSerializer {
|
|||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
if (model.id == null) {
|
||||
throw new FormatException("Missing required field 'id' on WeirdJoin.");
|
||||
}
|
||||
|
||||
if (model.unorthodox == null) {
|
||||
throw new FormatException(
|
||||
"Missing required field 'unorthodox' on WeirdJoin.");
|
||||
}
|
||||
|
||||
if (model.song == null) {
|
||||
throw new FormatException("Missing required field 'song' on WeirdJoin.");
|
||||
}
|
||||
|
||||
if (model.numbas == null) {
|
||||
throw new FormatException(
|
||||
"Missing required field 'numbas' on WeirdJoin.");
|
||||
}
|
||||
|
||||
if (model.foos == null) {
|
||||
throw new FormatException("Missing required field 'foos' on WeirdJoin.");
|
||||
}
|
||||
|
||||
return {
|
||||
'id': model.id,
|
||||
'unorthodox': UnorthodoxSerializer.toMap(model.unorthodox),
|
||||
|
@ -1186,15 +1129,6 @@ abstract class WeirdJoinFields {
|
|||
|
||||
abstract class SongSerializer {
|
||||
static Song fromMap(Map map) {
|
||||
if (map['weird_join_id'] == null) {
|
||||
throw new FormatException(
|
||||
"Missing required field 'weird_join_id' on Song.");
|
||||
}
|
||||
|
||||
if (map['title'] == null) {
|
||||
throw new FormatException("Missing required field 'title' on Song.");
|
||||
}
|
||||
|
||||
return new Song(
|
||||
id: map['id'] as String,
|
||||
weirdJoinId: map['weird_join_id'] as int,
|
||||
|
@ -1215,15 +1149,6 @@ abstract class SongSerializer {
|
|||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
if (model.weirdJoinId == null) {
|
||||
throw new FormatException(
|
||||
"Missing required field 'weird_join_id' on Song.");
|
||||
}
|
||||
|
||||
if (model.title == null) {
|
||||
throw new FormatException("Missing required field 'title' on Song.");
|
||||
}
|
||||
|
||||
return {
|
||||
'id': model.id,
|
||||
'weird_join_id': model.weirdJoinId,
|
||||
|
@ -1256,14 +1181,6 @@ abstract class SongFields {
|
|||
|
||||
abstract class NumbaSerializer {
|
||||
static Numba fromMap(Map map) {
|
||||
if (map['i'] == null) {
|
||||
throw new FormatException("Missing required field 'i' on Numba.");
|
||||
}
|
||||
|
||||
if (map['parent'] == null) {
|
||||
throw new FormatException("Missing required field 'parent' on Numba.");
|
||||
}
|
||||
|
||||
return new Numba(i: map['i'] as int, parent: map['parent'] as int);
|
||||
}
|
||||
|
||||
|
@ -1271,14 +1188,6 @@ abstract class NumbaSerializer {
|
|||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
if (model.i == null) {
|
||||
throw new FormatException("Missing required field 'i' on Numba.");
|
||||
}
|
||||
|
||||
if (model.parent == null) {
|
||||
throw new FormatException("Missing required field 'parent' on Numba.");
|
||||
}
|
||||
|
||||
return {'i': model.i, 'parent': model.parent};
|
||||
}
|
||||
}
|
||||
|
@ -1293,14 +1202,6 @@ abstract class NumbaFields {
|
|||
|
||||
abstract class FooSerializer {
|
||||
static Foo fromMap(Map map) {
|
||||
if (map['bar'] == null) {
|
||||
throw new FormatException("Missing required field 'bar' on Foo.");
|
||||
}
|
||||
|
||||
if (map['weird_joins'] == null) {
|
||||
throw new FormatException("Missing required field 'weird_joins' on Foo.");
|
||||
}
|
||||
|
||||
return new Foo(
|
||||
bar: map['bar'] as String,
|
||||
weirdJoins: map['weird_joins'] is Iterable
|
||||
|
@ -1315,14 +1216,6 @@ abstract class FooSerializer {
|
|||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
if (model.bar == null) {
|
||||
throw new FormatException("Missing required field 'bar' on Foo.");
|
||||
}
|
||||
|
||||
if (model.weirdJoins == null) {
|
||||
throw new FormatException("Missing required field 'weird_joins' on Foo.");
|
||||
}
|
||||
|
||||
return {
|
||||
'bar': model.bar,
|
||||
'weird_joins':
|
||||
|
@ -1341,15 +1234,6 @@ abstract class FooFields {
|
|||
|
||||
abstract class FooPivotSerializer {
|
||||
static FooPivot fromMap(Map map) {
|
||||
if (map['weird_join'] == null) {
|
||||
throw new FormatException(
|
||||
"Missing required field 'weird_join' on FooPivot.");
|
||||
}
|
||||
|
||||
if (map['foo'] == null) {
|
||||
throw new FormatException("Missing required field 'foo' on FooPivot.");
|
||||
}
|
||||
|
||||
return new FooPivot(
|
||||
weirdJoin: map['weird_join'] != null
|
||||
? WeirdJoinSerializer.fromMap(map['weird_join'] as Map)
|
||||
|
@ -1363,15 +1247,6 @@ abstract class FooPivotSerializer {
|
|||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
if (model.weirdJoin == null) {
|
||||
throw new FormatException(
|
||||
"Missing required field 'weird_join' on FooPivot.");
|
||||
}
|
||||
|
||||
if (model.foo == null) {
|
||||
throw new FormatException("Missing required field 'foo' on FooPivot.");
|
||||
}
|
||||
|
||||
return {
|
||||
'weird_join': WeirdJoinSerializer.toMap(model.weirdJoin),
|
||||
'foo': FooSerializer.toMap(model.foo)
|
||||
|
|
|
@ -570,10 +570,10 @@ class RoleQueryValues extends MapQueryValues {
|
|||
class User extends _User {
|
||||
User(
|
||||
{this.id,
|
||||
@required this.username,
|
||||
@required this.password,
|
||||
@required this.email,
|
||||
@required List<_Role> roles,
|
||||
this.username,
|
||||
this.password,
|
||||
this.email,
|
||||
List<_Role> roles,
|
||||
this.createdAt,
|
||||
this.updatedAt})
|
||||
: this.roles = new List.unmodifiable(roles ?? []);
|
||||
|
@ -642,7 +642,7 @@ class User extends _User {
|
|||
|
||||
@generatedSerializable
|
||||
class RoleUser implements _RoleUser {
|
||||
const RoleUser({@required this.role, @required this.user});
|
||||
const RoleUser({this.role, this.user});
|
||||
|
||||
@override
|
||||
final _Role role;
|
||||
|
@ -670,12 +670,7 @@ class RoleUser implements _RoleUser {
|
|||
|
||||
@generatedSerializable
|
||||
class Role extends _Role {
|
||||
Role(
|
||||
{this.id,
|
||||
@required this.name,
|
||||
@required List<_User> users,
|
||||
this.createdAt,
|
||||
this.updatedAt})
|
||||
Role({this.id, this.name, List<_User> users, this.createdAt, this.updatedAt})
|
||||
: this.users = new List.unmodifiable(users ?? []);
|
||||
|
||||
@override
|
||||
|
@ -733,22 +728,6 @@ class Role extends _Role {
|
|||
|
||||
abstract class UserSerializer {
|
||||
static User fromMap(Map map) {
|
||||
if (map['username'] == null) {
|
||||
throw new FormatException("Missing required field 'username' on User.");
|
||||
}
|
||||
|
||||
if (map['password'] == null) {
|
||||
throw new FormatException("Missing required field 'password' on User.");
|
||||
}
|
||||
|
||||
if (map['email'] == null) {
|
||||
throw new FormatException("Missing required field 'email' on User.");
|
||||
}
|
||||
|
||||
if (map['roles'] == null) {
|
||||
throw new FormatException("Missing required field 'roles' on User.");
|
||||
}
|
||||
|
||||
return new User(
|
||||
id: map['id'] as String,
|
||||
username: map['username'] as String,
|
||||
|
@ -776,22 +755,6 @@ abstract class UserSerializer {
|
|||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
if (model.username == null) {
|
||||
throw new FormatException("Missing required field 'username' on User.");
|
||||
}
|
||||
|
||||
if (model.password == null) {
|
||||
throw new FormatException("Missing required field 'password' on User.");
|
||||
}
|
||||
|
||||
if (model.email == null) {
|
||||
throw new FormatException("Missing required field 'email' on User.");
|
||||
}
|
||||
|
||||
if (model.roles == null) {
|
||||
throw new FormatException("Missing required field 'roles' on User.");
|
||||
}
|
||||
|
||||
return {
|
||||
'id': model.id,
|
||||
'username': model.username,
|
||||
|
@ -832,14 +795,6 @@ abstract class UserFields {
|
|||
|
||||
abstract class RoleUserSerializer {
|
||||
static RoleUser fromMap(Map map) {
|
||||
if (map['role'] == null) {
|
||||
throw new FormatException("Missing required field 'role' on RoleUser.");
|
||||
}
|
||||
|
||||
if (map['user'] == null) {
|
||||
throw new FormatException("Missing required field 'user' on RoleUser.");
|
||||
}
|
||||
|
||||
return new RoleUser(
|
||||
role: map['role'] != null
|
||||
? RoleSerializer.fromMap(map['role'] as Map)
|
||||
|
@ -853,14 +808,6 @@ abstract class RoleUserSerializer {
|
|||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
if (model.role == null) {
|
||||
throw new FormatException("Missing required field 'role' on RoleUser.");
|
||||
}
|
||||
|
||||
if (model.user == null) {
|
||||
throw new FormatException("Missing required field 'user' on RoleUser.");
|
||||
}
|
||||
|
||||
return {
|
||||
'role': RoleSerializer.toMap(model.role),
|
||||
'user': UserSerializer.toMap(model.user)
|
||||
|
@ -878,14 +825,6 @@ abstract class RoleUserFields {
|
|||
|
||||
abstract class RoleSerializer {
|
||||
static Role fromMap(Map map) {
|
||||
if (map['name'] == null) {
|
||||
throw new FormatException("Missing required field 'name' on Role.");
|
||||
}
|
||||
|
||||
if (map['users'] == null) {
|
||||
throw new FormatException("Missing required field 'users' on Role.");
|
||||
}
|
||||
|
||||
return new Role(
|
||||
id: map['id'] as String,
|
||||
name: map['name'] as String,
|
||||
|
@ -911,14 +850,6 @@ abstract class RoleSerializer {
|
|||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
if (model.name == null) {
|
||||
throw new FormatException("Missing required field 'name' on Role.");
|
||||
}
|
||||
|
||||
if (model.users == null) {
|
||||
throw new FormatException("Missing required field 'users' on Role.");
|
||||
}
|
||||
|
||||
return {
|
||||
'id': model.id,
|
||||
'name': model.name,
|
||||
|
|
Loading…
Reference in a new issue