@required where necessary
This commit is contained in:
parent
d2785741dc
commit
65a58365cf
14 changed files with 441 additions and 47 deletions
|
@ -38,3 +38,5 @@ dev_dependencies:
|
||||||
dependency_overrides:
|
dependency_overrides:
|
||||||
angel_orm:
|
angel_orm:
|
||||||
path: ../angel_orm
|
path: ../angel_orm
|
||||||
|
angel_serialize_generator:
|
||||||
|
path: ../../serialize/angel_serialize_generator
|
||||||
|
|
|
@ -142,11 +142,7 @@ class AuthorQueryValues extends MapQueryValues {
|
||||||
|
|
||||||
@generatedSerializable
|
@generatedSerializable
|
||||||
class Author extends _Author {
|
class Author extends _Author {
|
||||||
Author(
|
Author({this.id, this.name = 'Tobe Osakwe', this.createdAt, this.updatedAt});
|
||||||
{this.id,
|
|
||||||
@required this.name = 'Tobe Osakwe',
|
|
||||||
this.createdAt,
|
|
||||||
this.updatedAt});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final String id;
|
final String id;
|
||||||
|
|
|
@ -188,9 +188,9 @@ class BookQueryValues extends MapQueryValues {
|
||||||
class Book extends _Book {
|
class Book extends _Book {
|
||||||
Book(
|
Book(
|
||||||
{this.id,
|
{this.id,
|
||||||
this.author,
|
@required this.author,
|
||||||
this.partnerAuthor,
|
@required this.partnerAuthor,
|
||||||
this.name,
|
@required this.name,
|
||||||
this.createdAt,
|
this.createdAt,
|
||||||
this.updatedAt});
|
this.updatedAt});
|
||||||
|
|
||||||
|
@ -254,6 +254,19 @@ class Book extends _Book {
|
||||||
|
|
||||||
abstract class BookSerializer {
|
abstract class BookSerializer {
|
||||||
static Book fromMap(Map map) {
|
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(
|
return new Book(
|
||||||
id: map['id'] as String,
|
id: map['id'] as String,
|
||||||
author: map['author'] != null
|
author: map['author'] != null
|
||||||
|
@ -279,6 +292,19 @@ abstract class BookSerializer {
|
||||||
if (model == null) {
|
if (model == null) {
|
||||||
return 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 {
|
return {
|
||||||
'id': model.id,
|
'id': model.id,
|
||||||
'author': AuthorSerializer.toMap(model.author),
|
'author': AuthorSerializer.toMap(model.author),
|
||||||
|
|
|
@ -191,10 +191,10 @@ class CarQueryValues extends MapQueryValues {
|
||||||
class Car extends _Car {
|
class Car extends _Car {
|
||||||
Car(
|
Car(
|
||||||
{this.id,
|
{this.id,
|
||||||
this.make,
|
@required this.make,
|
||||||
this.description,
|
@required this.description,
|
||||||
this.familyFriendly,
|
@required this.familyFriendly,
|
||||||
this.recalledAt,
|
@required this.recalledAt,
|
||||||
this.createdAt,
|
this.createdAt,
|
||||||
this.updatedAt});
|
this.updatedAt});
|
||||||
|
|
||||||
|
@ -272,6 +272,23 @@ class Car extends _Car {
|
||||||
|
|
||||||
abstract class CarSerializer {
|
abstract class CarSerializer {
|
||||||
static Car fromMap(Map map) {
|
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(
|
return new Car(
|
||||||
id: map['id'] as String,
|
id: map['id'] as String,
|
||||||
make: map['make'] as String,
|
make: map['make'] as String,
|
||||||
|
@ -298,6 +315,23 @@ abstract class CarSerializer {
|
||||||
if (model == null) {
|
if (model == null) {
|
||||||
return 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 {
|
return {
|
||||||
'id': model.id,
|
'id': model.id,
|
||||||
'make': model.make,
|
'make': model.make,
|
||||||
|
|
|
@ -151,7 +151,12 @@ class FootQueryValues extends MapQueryValues {
|
||||||
|
|
||||||
@generatedSerializable
|
@generatedSerializable
|
||||||
class Foot extends _Foot {
|
class Foot extends _Foot {
|
||||||
Foot({this.id, this.legId, this.nToes, this.createdAt, this.updatedAt});
|
Foot(
|
||||||
|
{this.id,
|
||||||
|
@required this.legId,
|
||||||
|
@required this.nToes,
|
||||||
|
this.createdAt,
|
||||||
|
this.updatedAt});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final String id;
|
final String id;
|
||||||
|
@ -207,6 +212,14 @@ class Foot extends _Foot {
|
||||||
|
|
||||||
abstract class FootSerializer {
|
abstract class FootSerializer {
|
||||||
static Foot fromMap(Map map) {
|
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(
|
return new Foot(
|
||||||
id: map['id'] as String,
|
id: map['id'] as String,
|
||||||
legId: map['leg_id'] as int,
|
legId: map['leg_id'] as int,
|
||||||
|
@ -227,6 +240,14 @@ abstract class FootSerializer {
|
||||||
if (model == null) {
|
if (model == null) {
|
||||||
return 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 {
|
return {
|
||||||
'id': model.id,
|
'id': model.id,
|
||||||
'leg_id': model.legId,
|
'leg_id': model.legId,
|
||||||
|
|
|
@ -152,7 +152,11 @@ class FruitQueryValues extends MapQueryValues {
|
||||||
@generatedSerializable
|
@generatedSerializable
|
||||||
class Fruit extends _Fruit {
|
class Fruit extends _Fruit {
|
||||||
Fruit(
|
Fruit(
|
||||||
{this.id, this.treeId, this.commonName, this.createdAt, this.updatedAt});
|
{this.id,
|
||||||
|
@required this.treeId,
|
||||||
|
@required this.commonName,
|
||||||
|
this.createdAt,
|
||||||
|
this.updatedAt});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final String id;
|
final String id;
|
||||||
|
@ -208,6 +212,15 @@ class Fruit extends _Fruit {
|
||||||
|
|
||||||
abstract class FruitSerializer {
|
abstract class FruitSerializer {
|
||||||
static Fruit fromMap(Map map) {
|
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(
|
return new Fruit(
|
||||||
id: map['id'] as String,
|
id: map['id'] as String,
|
||||||
treeId: map['tree_id'] as int,
|
treeId: map['tree_id'] as int,
|
||||||
|
@ -228,6 +241,15 @@ abstract class FruitSerializer {
|
||||||
if (model == null) {
|
if (model == null) {
|
||||||
return 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 {
|
return {
|
||||||
'id': model.id,
|
'id': model.id,
|
||||||
'tree_id': model.treeId,
|
'tree_id': model.treeId,
|
||||||
|
|
|
@ -20,6 +20,6 @@ abstract class _HasCar extends Model {
|
||||||
// serializesTo: Map, serializer: #_carToMap, deserializer: #_carFromMap)
|
// serializesTo: Map, serializer: #_carToMap, deserializer: #_carFromMap)
|
||||||
// Car get car;
|
// Car get car;
|
||||||
|
|
||||||
@SerializableField(isNullable: false)
|
@SerializableField(isNullable: false, defaultValue: CarType.sedan)
|
||||||
CarType get type;
|
CarType get type;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ class HasCarMigration extends Migration {
|
||||||
up(Schema schema) {
|
up(Schema schema) {
|
||||||
schema.create('has_cars', (table) {
|
schema.create('has_cars', (table) {
|
||||||
table.serial('id')..primaryKey();
|
table.serial('id')..primaryKey();
|
||||||
table.integer('type');
|
table.integer('type')..defaultsTo(0);
|
||||||
table.timeStamp('created_at');
|
table.timeStamp('created_at');
|
||||||
table.timeStamp('updated_at');
|
table.timeStamp('updated_at');
|
||||||
});
|
});
|
||||||
|
@ -140,7 +140,7 @@ class HasCarQueryValues extends MapQueryValues {
|
||||||
|
|
||||||
@generatedSerializable
|
@generatedSerializable
|
||||||
class HasCar extends _HasCar {
|
class HasCar extends _HasCar {
|
||||||
HasCar({this.id, @required this.type, this.createdAt, this.updatedAt});
|
HasCar({this.id, this.type = CarType.sedan, this.createdAt, this.updatedAt});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final String id;
|
final String id;
|
||||||
|
@ -195,7 +195,9 @@ abstract class HasCarSerializer {
|
||||||
id: map['id'] as String,
|
id: map['id'] as String,
|
||||||
type: map['type'] is CarType
|
type: map['type'] is CarType
|
||||||
? (map['type'] as CarType)
|
? (map['type'] as CarType)
|
||||||
: (map['type'] is int ? CarType.values[map['type'] as int] : null),
|
: (map['type'] is int
|
||||||
|
? CarType.values[map['type'] as int]
|
||||||
|
: CarType.sedan),
|
||||||
createdAt: map['created_at'] != null
|
createdAt: map['created_at'] != null
|
||||||
? (map['created_at'] is DateTime
|
? (map['created_at'] is DateTime
|
||||||
? (map['created_at'] as DateTime)
|
? (map['created_at'] as DateTime)
|
||||||
|
|
|
@ -119,7 +119,9 @@ class HasMapQueryValues extends MapQueryValues {
|
||||||
|
|
||||||
@generatedSerializable
|
@generatedSerializable
|
||||||
class HasMap implements _HasMap {
|
class HasMap implements _HasMap {
|
||||||
const HasMap({Map<dynamic, dynamic> this.value, List<dynamic> this.list});
|
const HasMap(
|
||||||
|
{@required Map<dynamic, dynamic> this.value,
|
||||||
|
@required List<dynamic> this.list});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final Map<dynamic, dynamic> value;
|
final Map<dynamic, dynamic> value;
|
||||||
|
@ -156,6 +158,14 @@ class HasMap implements _HasMap {
|
||||||
|
|
||||||
abstract class HasMapSerializer {
|
abstract class HasMapSerializer {
|
||||||
static HasMap fromMap(Map map) {
|
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(
|
return new HasMap(
|
||||||
value: map['value'] is Map
|
value: map['value'] is Map
|
||||||
? (map['value'] as Map).cast<dynamic, dynamic>()
|
? (map['value'] as Map).cast<dynamic, dynamic>()
|
||||||
|
@ -169,6 +179,14 @@ abstract class HasMapSerializer {
|
||||||
if (model == null) {
|
if (model == null) {
|
||||||
return 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};
|
return {'value': model.value, 'list': model.list};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ class LegMigration extends Migration {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
down(Schema schema) {
|
down(Schema schema) {
|
||||||
schema.drop('legs');
|
schema.drop('legs', cascade: true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,7 +152,12 @@ class LegQueryValues extends MapQueryValues {
|
||||||
|
|
||||||
@generatedSerializable
|
@generatedSerializable
|
||||||
class Leg extends _Leg {
|
class Leg extends _Leg {
|
||||||
Leg({this.id, this.foot, this.name, this.createdAt, this.updatedAt});
|
Leg(
|
||||||
|
{this.id,
|
||||||
|
@required this.foot,
|
||||||
|
@required this.name,
|
||||||
|
this.createdAt,
|
||||||
|
this.updatedAt});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final String id;
|
final String id;
|
||||||
|
@ -208,6 +213,14 @@ class Leg extends _Leg {
|
||||||
|
|
||||||
abstract class LegSerializer {
|
abstract class LegSerializer {
|
||||||
static Leg fromMap(Map map) {
|
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(
|
return new Leg(
|
||||||
id: map['id'] as String,
|
id: map['id'] as String,
|
||||||
foot: map['foot'] != null
|
foot: map['foot'] != null
|
||||||
|
@ -230,6 +243,14 @@ abstract class LegSerializer {
|
||||||
if (model == null) {
|
if (model == null) {
|
||||||
return 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 {
|
return {
|
||||||
'id': model.id,
|
'id': model.id,
|
||||||
'foot': FootSerializer.toMap(model.foot),
|
'foot': FootSerializer.toMap(model.foot),
|
||||||
|
|
|
@ -199,10 +199,10 @@ class OrderQueryValues extends MapQueryValues {
|
||||||
class Order extends _Order {
|
class Order extends _Order {
|
||||||
Order(
|
Order(
|
||||||
{this.id,
|
{this.id,
|
||||||
this.customer,
|
@required this.customer,
|
||||||
this.employeeId,
|
@required this.employeeId,
|
||||||
this.orderDate,
|
@required this.orderDate,
|
||||||
this.shipperId,
|
@required this.shipperId,
|
||||||
this.createdAt,
|
this.createdAt,
|
||||||
this.updatedAt});
|
this.updatedAt});
|
||||||
|
|
||||||
|
@ -273,6 +273,25 @@ class Order extends _Order {
|
||||||
|
|
||||||
abstract class OrderSerializer {
|
abstract class OrderSerializer {
|
||||||
static Order fromMap(Map map) {
|
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(
|
return new Order(
|
||||||
id: map['id'] as String,
|
id: map['id'] as String,
|
||||||
customer: map['customer'] != null
|
customer: map['customer'] != null
|
||||||
|
@ -301,6 +320,25 @@ abstract class OrderSerializer {
|
||||||
if (model == null) {
|
if (model == null) {
|
||||||
return 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 {
|
return {
|
||||||
'id': model.id,
|
'id': model.id,
|
||||||
'customer': CustomerSerializer.toMap(model.customer),
|
'customer': CustomerSerializer.toMap(model.customer),
|
||||||
|
|
|
@ -19,7 +19,7 @@ class TreeMigration extends Migration {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
down(Schema schema) {
|
down(Schema schema) {
|
||||||
schema.drop('trees');
|
schema.drop('trees', cascade: true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,7 +213,11 @@ class TreeQueryValues extends MapQueryValues {
|
||||||
@generatedSerializable
|
@generatedSerializable
|
||||||
class Tree extends _Tree {
|
class Tree extends _Tree {
|
||||||
Tree(
|
Tree(
|
||||||
{this.id, this.rings, List<Fruit> fruits, this.createdAt, this.updatedAt})
|
{this.id,
|
||||||
|
@required this.rings,
|
||||||
|
@required List<Fruit> fruits,
|
||||||
|
this.createdAt,
|
||||||
|
this.updatedAt})
|
||||||
: this.fruits = new List.unmodifiable(fruits ?? []);
|
: this.fruits = new List.unmodifiable(fruits ?? []);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -271,6 +275,14 @@ class Tree extends _Tree {
|
||||||
|
|
||||||
abstract class TreeSerializer {
|
abstract class TreeSerializer {
|
||||||
static Tree fromMap(Map map) {
|
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(
|
return new Tree(
|
||||||
id: map['id'] as String,
|
id: map['id'] as String,
|
||||||
rings: map['rings'] as int,
|
rings: map['rings'] as int,
|
||||||
|
@ -296,6 +308,14 @@ abstract class TreeSerializer {
|
||||||
if (model == null) {
|
if (model == null) {
|
||||||
return 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 {
|
return {
|
||||||
'id': model.id,
|
'id': model.id,
|
||||||
'rings': model.rings,
|
'rings': model.rings,
|
||||||
|
|
|
@ -30,7 +30,7 @@ class WeirdJoinMigration extends Migration {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
down(Schema schema) {
|
down(Schema schema) {
|
||||||
schema.drop('weird_joins');
|
schema.drop('weird_joins', cascade: true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ class FooMigration extends Migration {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
down(Schema schema) {
|
down(Schema schema) {
|
||||||
schema.drop('foos');
|
schema.drop('foos', cascade: true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -821,7 +821,7 @@ class FooPivotQueryValues extends MapQueryValues {
|
||||||
|
|
||||||
@generatedSerializable
|
@generatedSerializable
|
||||||
class Unorthodox implements _Unorthodox {
|
class Unorthodox implements _Unorthodox {
|
||||||
const Unorthodox({this.name});
|
const Unorthodox({@required this.name});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final String name;
|
final String name;
|
||||||
|
@ -847,11 +847,11 @@ class Unorthodox implements _Unorthodox {
|
||||||
@generatedSerializable
|
@generatedSerializable
|
||||||
class WeirdJoin implements _WeirdJoin {
|
class WeirdJoin implements _WeirdJoin {
|
||||||
const WeirdJoin(
|
const WeirdJoin(
|
||||||
{this.id,
|
{@required this.id,
|
||||||
this.unorthodox,
|
@required this.unorthodox,
|
||||||
this.song,
|
@required this.song,
|
||||||
List<_Numba> this.numbas,
|
@required List<_Numba> this.numbas,
|
||||||
List<_Foo> this.foos});
|
@required List<_Foo> this.foos});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final int id;
|
final int id;
|
||||||
|
@ -905,7 +905,12 @@ class WeirdJoin implements _WeirdJoin {
|
||||||
|
|
||||||
@generatedSerializable
|
@generatedSerializable
|
||||||
class Song extends _Song {
|
class Song extends _Song {
|
||||||
Song({this.id, this.weirdJoinId, this.title, this.createdAt, this.updatedAt});
|
Song(
|
||||||
|
{this.id,
|
||||||
|
@required this.weirdJoinId,
|
||||||
|
@required this.title,
|
||||||
|
this.createdAt,
|
||||||
|
this.updatedAt});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final String id;
|
final String id;
|
||||||
|
@ -957,7 +962,7 @@ class Song extends _Song {
|
||||||
|
|
||||||
@generatedSerializable
|
@generatedSerializable
|
||||||
class Numba extends _Numba {
|
class Numba extends _Numba {
|
||||||
Numba({this.i, this.parent});
|
Numba({@required this.i, @required this.parent});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final int i;
|
final int i;
|
||||||
|
@ -985,7 +990,7 @@ class Numba extends _Numba {
|
||||||
|
|
||||||
@generatedSerializable
|
@generatedSerializable
|
||||||
class Foo implements _Foo {
|
class Foo implements _Foo {
|
||||||
const Foo({this.bar, List<_WeirdJoin> this.weirdJoins});
|
const Foo({@required this.bar, @required List<_WeirdJoin> this.weirdJoins});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final String bar;
|
final String bar;
|
||||||
|
@ -1017,7 +1022,7 @@ class Foo implements _Foo {
|
||||||
|
|
||||||
@generatedSerializable
|
@generatedSerializable
|
||||||
class FooPivot implements _FooPivot {
|
class FooPivot implements _FooPivot {
|
||||||
const FooPivot({this.weirdJoin, this.foo});
|
const FooPivot({@required this.weirdJoin, @required this.foo});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final _WeirdJoin weirdJoin;
|
final _WeirdJoin weirdJoin;
|
||||||
|
@ -1052,6 +1057,10 @@ class FooPivot implements _FooPivot {
|
||||||
|
|
||||||
abstract class UnorthodoxSerializer {
|
abstract class UnorthodoxSerializer {
|
||||||
static Unorthodox fromMap(Map map) {
|
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);
|
return new Unorthodox(name: map['name'] as String);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1059,6 +1068,10 @@ abstract class UnorthodoxSerializer {
|
||||||
if (model == null) {
|
if (model == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
if (model.name == null) {
|
||||||
|
throw new FormatException("Missing required field 'name' on Unorthodox.");
|
||||||
|
}
|
||||||
|
|
||||||
return {'name': model.name};
|
return {'name': model.name};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1071,6 +1084,28 @@ abstract class UnorthodoxFields {
|
||||||
|
|
||||||
abstract class WeirdJoinSerializer {
|
abstract class WeirdJoinSerializer {
|
||||||
static WeirdJoin fromMap(Map map) {
|
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(
|
return new WeirdJoin(
|
||||||
id: map['id'] as int,
|
id: map['id'] as int,
|
||||||
unorthodox: map['unorthodox'] != null
|
unorthodox: map['unorthodox'] != null
|
||||||
|
@ -1097,6 +1132,28 @@ abstract class WeirdJoinSerializer {
|
||||||
if (model == null) {
|
if (model == null) {
|
||||||
return 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 {
|
return {
|
||||||
'id': model.id,
|
'id': model.id,
|
||||||
'unorthodox': UnorthodoxSerializer.toMap(model.unorthodox),
|
'unorthodox': UnorthodoxSerializer.toMap(model.unorthodox),
|
||||||
|
@ -1129,6 +1186,15 @@ abstract class WeirdJoinFields {
|
||||||
|
|
||||||
abstract class SongSerializer {
|
abstract class SongSerializer {
|
||||||
static Song fromMap(Map map) {
|
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(
|
return new Song(
|
||||||
id: map['id'] as String,
|
id: map['id'] as String,
|
||||||
weirdJoinId: map['weird_join_id'] as int,
|
weirdJoinId: map['weird_join_id'] as int,
|
||||||
|
@ -1149,6 +1215,15 @@ abstract class SongSerializer {
|
||||||
if (model == null) {
|
if (model == null) {
|
||||||
return 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 {
|
return {
|
||||||
'id': model.id,
|
'id': model.id,
|
||||||
'weird_join_id': model.weirdJoinId,
|
'weird_join_id': model.weirdJoinId,
|
||||||
|
@ -1181,6 +1256,14 @@ abstract class SongFields {
|
||||||
|
|
||||||
abstract class NumbaSerializer {
|
abstract class NumbaSerializer {
|
||||||
static Numba fromMap(Map map) {
|
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);
|
return new Numba(i: map['i'] as int, parent: map['parent'] as int);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1188,6 +1271,14 @@ abstract class NumbaSerializer {
|
||||||
if (model == null) {
|
if (model == null) {
|
||||||
return 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};
|
return {'i': model.i, 'parent': model.parent};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1202,6 +1293,14 @@ abstract class NumbaFields {
|
||||||
|
|
||||||
abstract class FooSerializer {
|
abstract class FooSerializer {
|
||||||
static Foo fromMap(Map map) {
|
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(
|
return new Foo(
|
||||||
bar: map['bar'] as String,
|
bar: map['bar'] as String,
|
||||||
weirdJoins: map['weird_joins'] is Iterable
|
weirdJoins: map['weird_joins'] is Iterable
|
||||||
|
@ -1216,6 +1315,14 @@ abstract class FooSerializer {
|
||||||
if (model == null) {
|
if (model == null) {
|
||||||
return 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 {
|
return {
|
||||||
'bar': model.bar,
|
'bar': model.bar,
|
||||||
'weird_joins':
|
'weird_joins':
|
||||||
|
@ -1234,6 +1341,15 @@ abstract class FooFields {
|
||||||
|
|
||||||
abstract class FooPivotSerializer {
|
abstract class FooPivotSerializer {
|
||||||
static FooPivot fromMap(Map map) {
|
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(
|
return new FooPivot(
|
||||||
weirdJoin: map['weird_join'] != null
|
weirdJoin: map['weird_join'] != null
|
||||||
? WeirdJoinSerializer.fromMap(map['weird_join'] as Map)
|
? WeirdJoinSerializer.fromMap(map['weird_join'] as Map)
|
||||||
|
@ -1247,6 +1363,15 @@ abstract class FooPivotSerializer {
|
||||||
if (model == null) {
|
if (model == null) {
|
||||||
return 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 {
|
return {
|
||||||
'weird_join': WeirdJoinSerializer.toMap(model.weirdJoin),
|
'weird_join': WeirdJoinSerializer.toMap(model.weirdJoin),
|
||||||
'foo': FooSerializer.toMap(model.foo)
|
'foo': FooSerializer.toMap(model.foo)
|
||||||
|
|
|
@ -21,7 +21,7 @@ class UserMigration extends Migration {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
down(Schema schema) {
|
down(Schema schema) {
|
||||||
schema.drop('users');
|
schema.drop('users', cascade: true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ class RoleMigration extends Migration {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
down(Schema schema) {
|
down(Schema schema) {
|
||||||
schema.drop('roles');
|
schema.drop('roles', cascade: true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -570,10 +570,10 @@ class RoleQueryValues extends MapQueryValues {
|
||||||
class User extends _User {
|
class User extends _User {
|
||||||
User(
|
User(
|
||||||
{this.id,
|
{this.id,
|
||||||
this.username,
|
@required this.username,
|
||||||
this.password,
|
@required this.password,
|
||||||
this.email,
|
@required this.email,
|
||||||
List<_Role> roles,
|
@required List<_Role> roles,
|
||||||
this.createdAt,
|
this.createdAt,
|
||||||
this.updatedAt})
|
this.updatedAt})
|
||||||
: this.roles = new List.unmodifiable(roles ?? []);
|
: this.roles = new List.unmodifiable(roles ?? []);
|
||||||
|
@ -642,7 +642,7 @@ class User extends _User {
|
||||||
|
|
||||||
@generatedSerializable
|
@generatedSerializable
|
||||||
class RoleUser implements _RoleUser {
|
class RoleUser implements _RoleUser {
|
||||||
const RoleUser({this.role, this.user});
|
const RoleUser({@required this.role, @required this.user});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final _Role role;
|
final _Role role;
|
||||||
|
@ -670,7 +670,12 @@ class RoleUser implements _RoleUser {
|
||||||
|
|
||||||
@generatedSerializable
|
@generatedSerializable
|
||||||
class Role extends _Role {
|
class Role extends _Role {
|
||||||
Role({this.id, this.name, List<_User> users, this.createdAt, this.updatedAt})
|
Role(
|
||||||
|
{this.id,
|
||||||
|
@required this.name,
|
||||||
|
@required List<_User> users,
|
||||||
|
this.createdAt,
|
||||||
|
this.updatedAt})
|
||||||
: this.users = new List.unmodifiable(users ?? []);
|
: this.users = new List.unmodifiable(users ?? []);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -728,6 +733,22 @@ class Role extends _Role {
|
||||||
|
|
||||||
abstract class UserSerializer {
|
abstract class UserSerializer {
|
||||||
static User fromMap(Map map) {
|
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(
|
return new User(
|
||||||
id: map['id'] as String,
|
id: map['id'] as String,
|
||||||
username: map['username'] as String,
|
username: map['username'] as String,
|
||||||
|
@ -755,6 +776,22 @@ abstract class UserSerializer {
|
||||||
if (model == null) {
|
if (model == null) {
|
||||||
return 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 {
|
return {
|
||||||
'id': model.id,
|
'id': model.id,
|
||||||
'username': model.username,
|
'username': model.username,
|
||||||
|
@ -795,6 +832,14 @@ abstract class UserFields {
|
||||||
|
|
||||||
abstract class RoleUserSerializer {
|
abstract class RoleUserSerializer {
|
||||||
static RoleUser fromMap(Map map) {
|
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(
|
return new RoleUser(
|
||||||
role: map['role'] != null
|
role: map['role'] != null
|
||||||
? RoleSerializer.fromMap(map['role'] as Map)
|
? RoleSerializer.fromMap(map['role'] as Map)
|
||||||
|
@ -808,6 +853,14 @@ abstract class RoleUserSerializer {
|
||||||
if (model == null) {
|
if (model == null) {
|
||||||
return 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 {
|
return {
|
||||||
'role': RoleSerializer.toMap(model.role),
|
'role': RoleSerializer.toMap(model.role),
|
||||||
'user': UserSerializer.toMap(model.user)
|
'user': UserSerializer.toMap(model.user)
|
||||||
|
@ -825,6 +878,14 @@ abstract class RoleUserFields {
|
||||||
|
|
||||||
abstract class RoleSerializer {
|
abstract class RoleSerializer {
|
||||||
static Role fromMap(Map map) {
|
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(
|
return new Role(
|
||||||
id: map['id'] as String,
|
id: map['id'] as String,
|
||||||
name: map['name'] as String,
|
name: map['name'] as String,
|
||||||
|
@ -850,6 +911,14 @@ abstract class RoleSerializer {
|
||||||
if (model == null) {
|
if (model == null) {
|
||||||
return 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 {
|
return {
|
||||||
'id': model.id,
|
'id': model.id,
|
||||||
'name': model.name,
|
'name': model.name,
|
||||||
|
|
Loading…
Reference in a new issue