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

55 lines
1.2 KiB
Python
Raw Normal View History

2023-08-12 20:00:38 +08:00
from apiflask import Schema
from apiflask import fields
class BodyRecordIn(Schema):
height = fields.Float()
weight = fields.Float()
bmi = fields.Float()
2023-08-26 11:05:45 +08:00
class BodyRecordIdIn(Schema):
record_id = fields.String(required=True)
2023-09-20 14:22:39 +08:00
class BodyRecordCountOut(Schema):
count = fields.Integer()
2023-08-12 20:00:38 +08:00
class BodyRecordOut(Schema):
record_id = fields.String(attribute='_id')
height = fields.Float()
weight = fields.Float()
bmi = fields.Float()
create_time = fields.String()
update_time = fields.String(allow_none=True)
2023-08-13 21:08:29 +08:00
class BodyRecordsIn(Schema):
sort = fields.String()
current_date = fields.String()
2023-08-13 21:08:29 +08:00
2023-08-12 20:00:38 +08:00
class BodyRecordsOut(Schema):
2023-08-18 11:26:33 +08:00
records = fields.List(fields.Nested(BodyRecordOut))
2023-09-21 15:29:34 +08:00
previous_date = fields.String()
next_date = fields.String()
2023-08-18 11:26:33 +08:00
class BodyRecordChartIn(Schema):
current_date = fields.String(required=True)
period = fields.String()
2023-08-23 11:11:15 +08:00
user_id = fields.String()
2023-08-18 11:26:33 +08:00
class BodyRecordChartNestedOut(Schema):
weights = fields.List(fields.Float())
bmis = fields.List(fields.Float())
2023-08-18 11:32:29 +08:00
x_axis = fields.List(fields.String())
2023-08-18 11:26:33 +08:00
class BodyRecordChartOut(Schema):
chart_data = fields.Nested(BodyRecordChartNestedOut)
previous_date = fields.String()
next_date = fields.String()