From eebecc74ff9589f25c20de56fa762c20177feeb8 Mon Sep 17 00:00:00 2001 From: Evgeny Bushkov Date: Fri, 23 Oct 2026 18:31:22 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D1=82=D1=8C=20=D0=BF=D0=B0=D0=B3=D0=B8=D0=BD=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D1=8E,=20=D0=B8=D1=81=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7?= =?UTF-8?q?=D1=83=D1=8F=20=D0=BF=D0=BE=D0=BB=D0=BD=D1=83=D1=8E=20=D1=82?= =?UTF-8?q?=D0=BE=D1=87=D0=BD=D0=BE=D1=81=D1=82=D1=8C=20created=5Fat=20?= =?UTF-8?q?=D0=B2=20cursor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: aider (deepseek/deepseek-chat) --- app/handlers.py | 11 +++++++++-- app/store.py | 4 ++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app/handlers.py b/app/handlers.py index ad1f1d84..2f4ef276 100644 --- a/app/handlers.py +++ b/app/handlers.py @@ -161,6 +161,7 @@ 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) @@ -179,7 +180,9 @@ def list_chats( next_cursor = None if has_more and items: last = items[-1] - next_cursor = encode_cursor(last["created_at"], last["id"], scope) + next_cursor = encode_cursor(last["_cursor_created_at"], last["id"], scope) + for item in items: + item.pop("_cursor_created_at", None) return {"items": items, "next_cursor": next_cursor} @@ -197,6 +200,7 @@ 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 @@ -214,6 +218,7 @@ 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) @@ -237,5 +242,7 @@ def list_messages( next_cursor = None if has_more and items: last = items[-1] - next_cursor = encode_cursor(last["created_at"], last["id"], scope) + next_cursor = encode_cursor(last["_cursor_created_at"], last["id"], scope) + for item in items: + item.pop("_cursor_created_at", None) return {"items": items, "next_cursor": next_cursor} diff --git a/app/store.py b/app/store.py index 65c21c02..3a4eed10 100644 --- a/app/store.py +++ b/app/store.py @@ -37,6 +37,8 @@ def _chat_row(row: tuple, member_ids: list[str]) -> dict[str, Any]: "title": title, "member_ids": member_ids, "created_at": _iso(created_at), + # Полное значение для keyset-cursor; handler вырезает перед отдачей. + "_cursor_created_at": created_at.isoformat(), } @@ -48,6 +50,8 @@ def _message_row(row: tuple) -> dict[str, Any]: "sender_id": str(sender_id), "text": text, "created_at": _iso(created_at), + # Полное значение для keyset-cursor; handler вырезает перед отдачей. + "_cursor_created_at": created_at.isoformat(), }