feat-(smoke test passed)

This commit is contained in:
2026-11-06 15:56:10 +03:00
parent 97caa7e8ff
commit b9c2869b64
5 changed files with 30 additions and 14 deletions
+3 -3
View File
@@ -7,7 +7,7 @@ from src.pydantic_valid.page_response import PageResponse
from src.api.dependencies import DbSession, CurrentUser
from src.api.repositories.main_repo import Repository
from src.utils import generate_id, get_now_iso
import datetime
from datetime import datetime
router = APIRouter()
@@ -74,7 +74,7 @@ async def list_messages(session: DbSession, current_user: CurrentUser, chat_id:
cursor_msg_id = None
if cursor:
created_at_str, msg_id_str = _decode_msg_cursor(str(chat_id), cursor)
cursor_created_at = datetime.fromisoformat(created_at_str.replace("Z", "+00:00"))
cursor_created_at = datetime.fromisoformat(created_at_str)
cursor_msg_id = UUID(msg_id_str)
messages, has_more = await repo.messages.get_chat_messages(chat_id=chat_id, limit=limit, cursor_created_at=cursor_created_at, cursor_msg_id=cursor_msg_id)
@@ -82,7 +82,7 @@ async def list_messages(session: DbSession, current_user: CurrentUser, chat_id:
next_cursor = None
if has_more and messages:
last = messages[-1]
next_cursor = _encode_msg_cursor(chat_id=str(chat_id), created_at=last.created_at.strftime("%Y-%m-%dT%H:%M:%SZ"), msg_id=str(last.id))
next_cursor = _encode_msg_cursor(chat_id=str(chat_id), created_at=last.created_at.isoformat(), msg_id=str(last.id))
return PageResponse(
items=[Message(id=str(msg.id), chat_id=str(msg.chat_id), sender_id=str(msg.sender_id), text=msg.text, created_at=msg.created_at.strftime("%Y-%m-%dT%H:%M:%SZ"))