pzx-web-api/app/api/v1/schema/diet.py

40 lines
1.0 KiB
Python
Raw Normal View History

2023-09-15 18:00:17 +08:00
from apiflask import Schema
from apiflask import fields
class DietRecordsIn(Schema):
sort = fields.String()
current_date = fields.String()
2023-09-21 20:44:12 +08:00
user_id = fields.String(allow_none=True)
2023-09-15 18:00:17 +08:00
2023-09-19 14:59:17 +08:00
class heartOut(Schema):
nickname = fields.String()
avatar_url = fields.String()
create_time = fields.String()
class CommentOut(Schema):
nickname = fields.String()
avatar_url = fields.String()
comment = fields.String()
create_time = fields.String()
2023-09-15 18:00:17 +08:00
class DietRecordOut(Schema):
diet_id = fields.String(attribute='_id')
category = fields.String()
diet_image_id = fields.String()
diet_image_url = fields.URL()
2023-09-19 11:34:28 +08:00
heart_count = fields.Integer()
comment_count = fields.Integer()
2023-09-19 14:59:17 +08:00
hearts = fields.List(fields.Nested(heartOut))
comments = fields.List(fields.Nested(CommentOut))
2023-09-15 18:00:17 +08:00
create_time = fields.String()
update_time = fields.String(allow_none=True)
class DietRecordsOut(Schema):
2023-09-21 15:34:54 +08:00
records = fields.List(fields.Nested(DietRecordOut))
previous_date = fields.String()
next_date = fields.String()