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

55 lines
1.2 KiB
Python

from apiflask import Schema
from apiflask import fields
class BodyRecordIn(Schema):
height = fields.Float()
weight = fields.Float()
bmi = fields.Float()
class BodyRecordIdIn(Schema):
record_id = fields.String(required=True)
class BodyRecordCountOut(Schema):
count = fields.Integer()
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)
class BodyRecordsIn(Schema):
sort = fields.String()
current_date = fields.String()
class BodyRecordsOut(Schema):
records = fields.List(fields.Nested(BodyRecordOut))
previous_date = fields.String()
next_date = fields.String()
class BodyRecordChartIn(Schema):
current_date = fields.String(required=True)
period = fields.String()
user_id = fields.String()
class BodyRecordChartNestedOut(Schema):
weights = fields.List(fields.Float())
bmis = fields.List(fields.Float())
x_axis = fields.List(fields.String())
class BodyRecordChartOut(Schema):
chart_data = fields.Nested(BodyRecordChartNestedOut)
previous_date = fields.String()
next_date = fields.String()