From 1f9deccc89c77136749809342895ba73c9f47191 Mon Sep 17 00:00:00 2001 From: BryantHe Date: Thu, 21 Sep 2023 16:56:13 +0800 Subject: [PATCH] fix: adjust api of get_diet_records --- app/api/v1/diet.py | 3 ++- app/api/v1/schema/diet.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/api/v1/diet.py b/app/api/v1/diet.py index c92c2a6..ccee2aa 100644 --- a/app/api/v1/diet.py +++ b/app/api/v1/diet.py @@ -16,10 +16,11 @@ diet = APIBlueprint('diet', __name__) @diet.output(DietRecordsOut) @login_required def get_diet_records(query_data): + user_id = query_data['user_id'] if query_data.get('user_id') else session['user_id'] try: sort = query_data.get('sort', '-create_time') current_date = query_data.get('current_date', None) - results = rpc.diet.get_all_by_user(session['user_id'], + results = rpc.diet.get_all_by_user(user_id, sort=sort, current_date=current_date) except Exception as e: diff --git a/app/api/v1/schema/diet.py b/app/api/v1/schema/diet.py index e5f3e7a..afeb760 100644 --- a/app/api/v1/schema/diet.py +++ b/app/api/v1/schema/diet.py @@ -5,6 +5,7 @@ from apiflask import fields class DietRecordsIn(Schema): sort = fields.String() current_date = fields.String() + user_id = fields.String() class heartOut(Schema):