from apiflask import Schema from apiflask import fields class DietRecordsIn(Schema): sort = fields.String() current_date = fields.String() user_id = fields.String(allow_none=True) 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() class DietRecordOut(Schema): diet_id = fields.String(attribute='_id') category = fields.String() diet_image_id = fields.String() diet_image_url = fields.URL() heart_count = fields.Integer() comment_count = fields.Integer() hearts = fields.List(fields.Nested(heartOut)) comments = fields.List(fields.Nested(CommentOut)) create_time = fields.String() update_time = fields.String(allow_none=True) class DietRecordsOut(Schema): records = fields.List(fields.Nested(DietRecordOut)) previous_date = fields.String() next_date = fields.String()