Commit edff071c authored by Timothy J. Baek's avatar Timothy J. Baek
Browse files

refac

parent 3b487cfa
...@@ -265,19 +265,17 @@ class ChatTable: ...@@ -265,19 +265,17 @@ class ChatTable:
).all() ).all()
) )
# result has to be destrctured from sqlalchemy `row` and mapped to a dict since the `ChatModel`is not the returned dataclass. # result has to be destrctured from sqlalchemy `row` and mapped to a dict since the `ChatModel`is not the returned dataclass.
return list( return [
map( ChatTitleIdResponse.model_validate(
lambda row: ChatTitleIdResponse.model_validate( {
{ "id": chat[0],
"id": row[0], "title": chat[1],
"title": row[1], "updated_at": chat[2],
"updated_at": row[2], "created_at": chat[3],
"created_at": row[3], }
}
),
all_chats,
) )
) for chat in all_chats
]
def get_chat_list_by_chat_ids( def get_chat_list_by_chat_ids(
self, chat_ids: List[str], skip: int = 0, limit: int = 50 self, chat_ids: List[str], skip: int = 0, limit: int = 50
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment