From 6460a905a7a0338a47da9961b43462b6de03fb61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=80=C3=AE=C3=97=C3=9A=C3=95=C3=B1?= Date: Tue, 30 Aug 2022 10:22:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E5=88=86=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/api_v1/endpoints/interview.py | 11 ++--------- crud/crud_interview_tables.py | 2 +- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/api/api_v1/endpoints/interview.py b/api/api_v1/endpoints/interview.py index d8c077c..178ba3c 100644 --- a/api/api_v1/endpoints/interview.py +++ b/api/api_v1/endpoints/interview.py @@ -899,19 +899,12 @@ async def find_mode_tables( ) -> schemas.Msg: """获取一条hr分组包含的报表""" mode_data = await crud.api_interview_modes.get_one_mode(db, data_in.mode_id) - new_tables = [] + table_data = [] if mode_data: tables = mode_data['mode_list'] if tables: table_data = await crud.api_interview_tables.get_tables(db, {'table_id': {'$in': tables}}) - for table in table_data: - new_table = { - 'table_id': table['table_id'], - 'title': table['title'], - 'url': table['url'] - } - new_tables.append(new_table) - return schemas.Msg(code=200, msg='ok', data=new_tables) + return schemas.Msg(code=200, msg='ok', data=table_data) @router.post("/update_mode") diff --git a/crud/crud_interview_tables.py b/crud/crud_interview_tables.py index e06ec2c..170d948 100644 --- a/crud/crud_interview_tables.py +++ b/crud/crud_interview_tables.py @@ -26,7 +26,7 @@ class ApiInterviewTables(CRUDBase): # 查询报表信息 async def get_tables(self, db: AsyncIOMotorDatabase, where): - return await self.find_many(db, where) + return await self.find_many(db, where, {'_id': 0}) api_interview_tables = ApiInterviewTables('interview_tables')