From 7f21fac864d2ace7e245acc1bf9508f64055c8cc Mon Sep 17 00:00:00 2001 From: BryantHe Date: Tue, 19 Sep 2023 14:59:17 +0800 Subject: [PATCH] feat: diet schema add fields 2 --- app/api/v1/schema/diet.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/api/v1/schema/diet.py b/app/api/v1/schema/diet.py index e898e66..a1a6d73 100644 --- a/app/api/v1/schema/diet.py +++ b/app/api/v1/schema/diet.py @@ -7,6 +7,19 @@ class DietRecordsIn(Schema): current_date = fields.String() +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() @@ -14,6 +27,8 @@ class DietRecordOut(Schema): 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)