class Side(Schema): id = fields.Integer() name = fields.String() players = fields.List(fields.Nested(PlayerLight)) stats = fields.List(fields.Nested(Stats)) class Meta: dump_only = ["id"]
class Match(Schema): id = fields.Integer() game = fields.Nested(GameLight) results = fields.List(fields.Nested(Result)) created_at = fields.String() updated_at = fields.String() class Meta: dump_only = ["id", "created_at", "updated_at"]
class Player(Schema): id = fields.Integer() name = fields.String() stats = fields.List(fields.Nested(Stats)) class Meta: dump_only = ["id"]
class Visit(Schema): id = fields.Integer() visitor = fields.Nested(Visitor) visited_on = fields.String() message = fields.String() class Meta: dump_only = ["id", "visitor", "visited_on", "created_on"] load_only = ["visit_id", "visitor_id"]
class Stats(Schema): game = fields.Nested(GameLight) score_for = fields.Integer(default=0) score_against = fields.Integer(default=0) matches_played = fields.Integer(default=0) matches_won = fields.Integer(default=0) matches_lost = fields.Integer(default=0) class Meta: dump_only = ["id"]
class Result(Schema): side = fields.Nested(SideLight) score = fields.Integer(default=0)
class MatchNew(Schema): game = fields.String() results = fields.List(fields.Nested(ResultNew))