From cfdf372138e5d505a5963151c374780a1e4f5816 Mon Sep 17 00:00:00 2001 From: BryantHe Date: Wed, 23 Aug 2023 15:43:45 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=88=97=E8=A1=A8=E9=A1=B5=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=A2=9E=E5=8A=A0=20current=20date=20=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/v1/record.py | 5 ++++- app/api/v1/schema/record.py | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/api/v1/record.py b/app/api/v1/record.py index e65dcea..8165705 100644 --- a/app/api/v1/record.py +++ b/app/api/v1/record.py @@ -47,7 +47,10 @@ def get_record(record_id): def get_records(query_data): try: sort = query_data.get('sort', '-create_time') - results = rpc.body_record.get_all_by_user(session['user_id'], sort) + current_date = query_data.get('current_date', None) + results = rpc.body_record.get_all_by_user(session['user_id'], + sort=sort, + current_date=current_date) except Exception as e: raise BodyRecordNotFound(extra_data={'error_docs': str(e)}) return {'records': results} diff --git a/app/api/v1/schema/record.py b/app/api/v1/schema/record.py index cd01560..e021ba5 100644 --- a/app/api/v1/schema/record.py +++ b/app/api/v1/schema/record.py @@ -19,6 +19,7 @@ class BodyRecordOut(Schema): class BodyRecordsIn(Schema): sort = fields.String() + current_date = fields.String() class BodyRecordsOut(Schema):