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):