class ItemTransactionSchema(ma.SQLAlchemyAutoSchema): item = ma.Nested(ItemSchema) seller = ma.Nested(UserSchema) buyer = ma.Nested(UserSchema) class Meta: model = ItemTransaction
class ItemSchema(ma.SQLAlchemyAutoSchema): images = ma.Nested(ItemImageSchema, many=True) category = ma.Nested(CategorySchema) user = ma.Nested(UserSchema) remaining_format = ma.Nested(RemainingFormatSchema) item_favorites = ma.Nested(RemainingFormatSchema) class Meta: model = Item
class ItemWithSetCountSchema(Schema): set_count = ma.Integer() item = ma.Nested(ItemSchema) @post_dump def unnest(self, data, many): for key, val in data.items(): if key != 'Item': data['Item']['key'] = val return data['Item']
class KoeSchema(ma.SQLAlchemyAutoSchema): user = ma.Nested(UserSchema) item = ma.Nested(ItemSchema) class Meta: model = Koe
class KoeFavoriteSchema(ma.SQLAlchemyAutoSchema): Koe = ma.Nested(KoeSchema) user = ma.Nested(UserSchema) class Meta: model = KoeFavorite