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

43 lines
992 B
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()
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()
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))
class BodyRecordChartIn(Schema):
current_date = fields.String(required=True)
period = fields.String()
class BodyRecordChartNestedOut(Schema):
weights = fields.List(fields.Float())
bmis = fields.List(fields.Float())
x_axis = fields.List(fields.Float())
class BodyRecordChartOut(Schema):
chart_data = fields.Nested(BodyRecordChartNestedOut)
previous_date = fields.String()
next_date = fields.String()