fix: adjust api of get_diet_records
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
18213b3958
commit
1f9deccc89
|
@ -16,10 +16,11 @@ diet = APIBlueprint('diet', __name__)
|
||||||
@diet.output(DietRecordsOut)
|
@diet.output(DietRecordsOut)
|
||||||
@login_required
|
@login_required
|
||||||
def get_diet_records(query_data):
|
def get_diet_records(query_data):
|
||||||
|
user_id = query_data['user_id'] if query_data.get('user_id') else session['user_id']
|
||||||
try:
|
try:
|
||||||
sort = query_data.get('sort', '-create_time')
|
sort = query_data.get('sort', '-create_time')
|
||||||
current_date = query_data.get('current_date', None)
|
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,
|
sort=sort,
|
||||||
current_date=current_date)
|
current_date=current_date)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
@ -5,6 +5,7 @@ from apiflask import fields
|
||||||
class DietRecordsIn(Schema):
|
class DietRecordsIn(Schema):
|
||||||
sort = fields.String()
|
sort = fields.String()
|
||||||
current_date = fields.String()
|
current_date = fields.String()
|
||||||
|
user_id = fields.String()
|
||||||
|
|
||||||
|
|
||||||
class heartOut(Schema):
|
class heartOut(Schema):
|
||||||
|
|
Loading…
Reference in New Issue