fix: сохранить микросекунды в created_at для корректной keyset-пагинации

Co-authored-by: aider (deepseek/deepseek-chat) <aider@aider.chat>
This commit is contained in:
Evgeny Bushkov
2026-10-23 18:38:19 +03:00
co-authored by aider
parent eebecc74ff
commit ed7b43ecac
2 changed files with 4 additions and 14 deletions
+2 -9
View File
@@ -161,7 +161,6 @@ def create_chat(
if store.get_user(mid) is None:
raise ApiError(400, "invalid_request", "Неизвестный участник чата")
chat = store.create_chat(title, member_ids)
chat.pop("_cursor_created_at", None)
return JSONResponse(chat, status_code=201)
@@ -180,9 +179,7 @@ def list_chats(
next_cursor = None
if has_more and items:
last = items[-1]
next_cursor = encode_cursor(last["_cursor_created_at"], last["id"], scope)
for item in items:
item.pop("_cursor_created_at", None)
next_cursor = encode_cursor(last["created_at"], last["id"], scope)
return {"items": items, "next_cursor": next_cursor}
@@ -200,7 +197,6 @@ def get_chat(
chat = store.get_chat(chat_id)
if chat is None:
raise ApiError(404, "not_found", "Чат не найден")
chat.pop("_cursor_created_at", None)
return chat
@@ -218,7 +214,6 @@ def create_message(
raise ApiError(404, "not_found", "Чат не найден")
text = validate_create_message(body)
message = store.add_message(chat_id, caller, text)
message.pop("_cursor_created_at", None)
return JSONResponse(message, status_code=201)
@@ -242,7 +237,5 @@ def list_messages(
next_cursor = None
if has_more and items:
last = items[-1]
next_cursor = encode_cursor(last["_cursor_created_at"], last["id"], scope)
for item in items:
item.pop("_cursor_created_at", None)
next_cursor = encode_cursor(last["created_at"], last["id"], scope)
return {"items": items, "next_cursor": next_cursor}