добавлены чаты, сообщения и проверка сохранности
This commit is contained in:
Executable
+41
@@ -0,0 +1,41 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
echo "Stopping application and stores..."
|
||||||
|
docker compose down
|
||||||
|
|
||||||
|
echo "Starting application and stores..."
|
||||||
|
docker compose up -d
|
||||||
|
|
||||||
|
echo "Waiting for services to become healthy..."
|
||||||
|
|
||||||
|
for attempt in $(seq 1 60); do
|
||||||
|
postgres_status=$(
|
||||||
|
docker compose ps postgres --format json \
|
||||||
|
| python -c 'import sys, json; data=json.load(sys.stdin); print(data.get("Health", ""))'
|
||||||
|
)
|
||||||
|
|
||||||
|
redis_status=$(
|
||||||
|
docker compose ps redis --format json \
|
||||||
|
| python -c 'import sys, json; data=json.load(sys.stdin); print(data.get("Health", ""))'
|
||||||
|
)
|
||||||
|
|
||||||
|
api_status=$(
|
||||||
|
docker compose ps api --format json \
|
||||||
|
| python -c 'import sys, json; data=json.load(sys.stdin); print(data.get("Health", ""))'
|
||||||
|
)
|
||||||
|
|
||||||
|
if [[ "$postgres_status" == "healthy" \
|
||||||
|
&& "$redis_status" == "healthy" \
|
||||||
|
&& "$api_status" == "healthy" ]]; then
|
||||||
|
echo "All services are healthy."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Services did not become healthy in time." >&2
|
||||||
|
docker compose ps
|
||||||
|
exit 1
|
||||||
+134
-4
@@ -1,5 +1,5 @@
|
|||||||
from datetime import datetime, timedelta, timezone
|
from datetime import datetime, timedelta, timezone
|
||||||
from uuid import uuid4
|
from uuid import UUID, uuid4
|
||||||
|
|
||||||
from fastapi import Depends, FastAPI, Request
|
from fastapi import Depends, FastAPI, Request
|
||||||
from fastapi.exceptions import RequestValidationError
|
from fastapi.exceptions import RequestValidationError
|
||||||
@@ -16,11 +16,16 @@ from starlette.exceptions import HTTPException as StarletteHTTPException
|
|||||||
|
|
||||||
from src.database import get_db_session
|
from src.database import get_db_session
|
||||||
from src.errors import APIError
|
from src.errors import APIError
|
||||||
from src.models import CreateUser, SessionResponse, User
|
from src.models import CreateUser, SessionResponse, User, CreateChat, Chat, ChatPage, CreateMessage, Message, MessagePage
|
||||||
from src.repositories import (
|
from src.repositories import (
|
||||||
|
create_chat,
|
||||||
|
list_chats,
|
||||||
create_user as create_user_in_db,
|
create_user as create_user_in_db,
|
||||||
get_user_by_id,
|
get_user_by_id,
|
||||||
|
get_chat_by_id,
|
||||||
get_user_credentials_by_username,
|
get_user_credentials_by_username,
|
||||||
|
create_message,
|
||||||
|
get_messages,
|
||||||
)
|
)
|
||||||
from src.security import verify_password
|
from src.security import verify_password
|
||||||
from src.sessions import (
|
from src.sessions import (
|
||||||
@@ -286,7 +291,7 @@ async def create_auth_session(
|
|||||||
|
|
||||||
return SessionResponse(
|
return SessionResponse(
|
||||||
token=token,
|
token=token,
|
||||||
token_type="bearer",
|
token_type="Bearer",
|
||||||
expires_at=expires_at,
|
expires_at=expires_at,
|
||||||
user=user,
|
user=user,
|
||||||
)
|
)
|
||||||
@@ -300,4 +305,129 @@ async def delete_current_session(
|
|||||||
credentials: HTTPAuthorizationCredentials | None = Depends(bearer_security),
|
credentials: HTTPAuthorizationCredentials | None = Depends(bearer_security),
|
||||||
current_user: User = Depends(get_current_user),
|
current_user: User = Depends(get_current_user),
|
||||||
):
|
):
|
||||||
await delete_session(credentials.credentials)
|
await delete_session(credentials.credentials)
|
||||||
|
|
||||||
|
|
||||||
|
@app.post(
|
||||||
|
"/api/v1/chats",
|
||||||
|
response_model=Chat,
|
||||||
|
status_code=201,
|
||||||
|
)
|
||||||
|
async def create_chat_endpoint(
|
||||||
|
data: CreateChat,
|
||||||
|
current_user: User = Depends(get_current_user),
|
||||||
|
session: AsyncSession = Depends(get_db_session),
|
||||||
|
) -> Chat:
|
||||||
|
try:
|
||||||
|
chat = await create_chat(
|
||||||
|
session=session,
|
||||||
|
data=data,
|
||||||
|
current_user_id=current_user.id,
|
||||||
|
)
|
||||||
|
await session.commit()
|
||||||
|
except Exception:
|
||||||
|
await session.rollback()
|
||||||
|
raise
|
||||||
|
|
||||||
|
return chat
|
||||||
|
|
||||||
|
|
||||||
|
@app.get(
|
||||||
|
"/api/v1/chats",
|
||||||
|
response_model=ChatPage,
|
||||||
|
)
|
||||||
|
async def get_chats(
|
||||||
|
limit: int = 50,
|
||||||
|
current_user: User = Depends(get_current_user),
|
||||||
|
session: AsyncSession = Depends(get_db_session),
|
||||||
|
) -> ChatPage:
|
||||||
|
if limit < 1 or limit > 100:
|
||||||
|
raise APIError(
|
||||||
|
status_code=400,
|
||||||
|
code="invalid_request",
|
||||||
|
message="Limit must be between 1 and 100",
|
||||||
|
)
|
||||||
|
|
||||||
|
return await list_chats(
|
||||||
|
session=session,
|
||||||
|
current_user_id=current_user.id,
|
||||||
|
limit=limit,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@app.get(
|
||||||
|
"/api/v1/chats/{chat_id}",
|
||||||
|
response_model=Chat,
|
||||||
|
)
|
||||||
|
async def get_chat_endpoint(
|
||||||
|
chat_id: UUID,
|
||||||
|
current_user: User = Depends(get_current_user),
|
||||||
|
session: AsyncSession = Depends(get_db_session),
|
||||||
|
) -> Chat:
|
||||||
|
chat = await get_chat_by_id(
|
||||||
|
session=session,
|
||||||
|
chat_id=chat_id,
|
||||||
|
current_user_id=current_user.id,
|
||||||
|
)
|
||||||
|
|
||||||
|
if chat is None:
|
||||||
|
raise APIError(
|
||||||
|
status_code=404,
|
||||||
|
code="not_found",
|
||||||
|
message="Chat not found",
|
||||||
|
)
|
||||||
|
|
||||||
|
return chat
|
||||||
|
|
||||||
|
|
||||||
|
@app.post(
|
||||||
|
"/api/v1/chats/{chat_id}/messages",
|
||||||
|
response_model=Message,
|
||||||
|
status_code=201,
|
||||||
|
)
|
||||||
|
async def create_message_endpoint(
|
||||||
|
chat_id: UUID,
|
||||||
|
data: CreateMessage,
|
||||||
|
current_user: User = Depends(get_current_user),
|
||||||
|
session: AsyncSession = Depends(get_db_session),
|
||||||
|
) -> Message:
|
||||||
|
try:
|
||||||
|
message = await create_message(
|
||||||
|
session=session,
|
||||||
|
chat_id=chat_id,
|
||||||
|
current_user_id=current_user.id,
|
||||||
|
data=data,
|
||||||
|
)
|
||||||
|
await session.commit()
|
||||||
|
except Exception:
|
||||||
|
await session.rollback()
|
||||||
|
raise
|
||||||
|
|
||||||
|
return message
|
||||||
|
|
||||||
|
|
||||||
|
@app.get(
|
||||||
|
"/api/v1/chats/{chat_id}/messages",
|
||||||
|
response_model=MessagePage,
|
||||||
|
)
|
||||||
|
async def get_messages_endpoint(
|
||||||
|
chat_id: UUID,
|
||||||
|
limit: int = 50,
|
||||||
|
cursor: str | None = None,
|
||||||
|
current_user: User = Depends(get_current_user),
|
||||||
|
session: AsyncSession = Depends(get_db_session),
|
||||||
|
) -> MessagePage:
|
||||||
|
if limit < 1 or limit > 100:
|
||||||
|
raise APIError(
|
||||||
|
status_code=400,
|
||||||
|
code="invalid_request",
|
||||||
|
message="Limit must be between 1 and 100",
|
||||||
|
)
|
||||||
|
|
||||||
|
return await get_messages(
|
||||||
|
session=session,
|
||||||
|
chat_id=chat_id,
|
||||||
|
current_user_id=current_user.id,
|
||||||
|
limit=limit,
|
||||||
|
cursor=cursor,
|
||||||
|
)
|
||||||
+424
-1
@@ -3,8 +3,10 @@ from uuid import UUID, uuid4
|
|||||||
from sqlalchemy import text
|
from sqlalchemy import text
|
||||||
from sqlalchemy.ext.asyncio import AsyncSession
|
from sqlalchemy.ext.asyncio import AsyncSession
|
||||||
|
|
||||||
from src.models import CreateUser, User
|
from src.models import Chat, ChatPage, CreateChat, CreateUser, User, CreateMessage, Message, MessagePage
|
||||||
from src.security import hash_password
|
from src.security import hash_password
|
||||||
|
from src.errors import APIError
|
||||||
|
from src.cursor import decode_cursor, encode_cursor
|
||||||
|
|
||||||
|
|
||||||
async def create_user(
|
async def create_user(
|
||||||
@@ -109,4 +111,425 @@ async def get_user_by_id(
|
|||||||
username=row.username,
|
username=row.username,
|
||||||
display_name=row.display_name,
|
display_name=row.display_name,
|
||||||
created_at=row.created_at,
|
created_at=row.created_at,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
async def create_chat(
|
||||||
|
session: AsyncSession,
|
||||||
|
data: CreateChat,
|
||||||
|
current_user_id: UUID,
|
||||||
|
) -> Chat:
|
||||||
|
if current_user_id not in data.member_ids:
|
||||||
|
raise APIError(
|
||||||
|
status_code=400,
|
||||||
|
code="invalid_request",
|
||||||
|
message="Current user must be a chat member",
|
||||||
|
)
|
||||||
|
|
||||||
|
users_result = await session.execute(
|
||||||
|
text(
|
||||||
|
"""
|
||||||
|
SELECT id
|
||||||
|
FROM users
|
||||||
|
WHERE id = ANY(:member_ids)
|
||||||
|
"""
|
||||||
|
),
|
||||||
|
{
|
||||||
|
"member_ids": data.member_ids,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
existing_user_ids = {
|
||||||
|
UUID(str(row.id))
|
||||||
|
for row in users_result
|
||||||
|
}
|
||||||
|
|
||||||
|
if existing_user_ids != set(data.member_ids):
|
||||||
|
raise APIError(
|
||||||
|
status_code=400,
|
||||||
|
code="invalid_request",
|
||||||
|
message="Unknown chat member",
|
||||||
|
)
|
||||||
|
|
||||||
|
chat_id = uuid4()
|
||||||
|
|
||||||
|
chat_result = await session.execute(
|
||||||
|
text(
|
||||||
|
"""
|
||||||
|
INSERT INTO chats (
|
||||||
|
id,
|
||||||
|
title
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
:id,
|
||||||
|
:title
|
||||||
|
)
|
||||||
|
RETURNING
|
||||||
|
id,
|
||||||
|
title,
|
||||||
|
created_at
|
||||||
|
"""
|
||||||
|
),
|
||||||
|
{
|
||||||
|
"id": chat_id,
|
||||||
|
"title": data.title,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
chat_row = chat_result.one()
|
||||||
|
|
||||||
|
for member_id in data.member_ids:
|
||||||
|
await session.execute(
|
||||||
|
text(
|
||||||
|
"""
|
||||||
|
INSERT INTO chat_members (
|
||||||
|
chat_id,
|
||||||
|
user_id
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
:chat_id,
|
||||||
|
:user_id
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
),
|
||||||
|
{
|
||||||
|
"chat_id": chat_id,
|
||||||
|
"user_id": member_id,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
return Chat(
|
||||||
|
id=UUID(str(chat_row.id)),
|
||||||
|
title=chat_row.title,
|
||||||
|
member_ids=data.member_ids,
|
||||||
|
created_at=chat_row.created_at,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
async def get_chat_by_id(
|
||||||
|
session: AsyncSession,
|
||||||
|
chat_id: UUID,
|
||||||
|
current_user_id: UUID,
|
||||||
|
) -> Chat | None:
|
||||||
|
chat_result = await session.execute(
|
||||||
|
text(
|
||||||
|
"""
|
||||||
|
SELECT
|
||||||
|
c.id,
|
||||||
|
c.title,
|
||||||
|
c.created_at
|
||||||
|
FROM chats AS c
|
||||||
|
JOIN chat_members AS cm
|
||||||
|
ON cm.chat_id = c.id
|
||||||
|
WHERE c.id = :chat_id
|
||||||
|
AND cm.user_id = :current_user_id
|
||||||
|
"""
|
||||||
|
),
|
||||||
|
{
|
||||||
|
"chat_id": chat_id,
|
||||||
|
"current_user_id": current_user_id,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
chat_row = chat_result.one_or_none()
|
||||||
|
|
||||||
|
if chat_row is None:
|
||||||
|
return None
|
||||||
|
|
||||||
|
members_result = await session.execute(
|
||||||
|
text(
|
||||||
|
"""
|
||||||
|
SELECT user_id
|
||||||
|
FROM chat_members
|
||||||
|
WHERE chat_id = :chat_id
|
||||||
|
ORDER BY user_id
|
||||||
|
"""
|
||||||
|
),
|
||||||
|
{
|
||||||
|
"chat_id": chat_id,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
member_ids = [
|
||||||
|
UUID(str(row.user_id))
|
||||||
|
for row in members_result
|
||||||
|
]
|
||||||
|
|
||||||
|
return Chat(
|
||||||
|
id=UUID(str(chat_row.id)),
|
||||||
|
title=chat_row.title,
|
||||||
|
member_ids=member_ids,
|
||||||
|
created_at=chat_row.created_at,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
async def list_chats(
|
||||||
|
session: AsyncSession,
|
||||||
|
current_user_id: UUID,
|
||||||
|
limit: int,
|
||||||
|
) -> ChatPage:
|
||||||
|
chats_result = await session.execute(
|
||||||
|
text(
|
||||||
|
"""
|
||||||
|
SELECT
|
||||||
|
c.id,
|
||||||
|
c.title,
|
||||||
|
c.created_at
|
||||||
|
FROM chats AS c
|
||||||
|
JOIN chat_members AS cm
|
||||||
|
ON cm.chat_id = c.id
|
||||||
|
WHERE cm.user_id = :current_user_id
|
||||||
|
ORDER BY c.created_at, c.id
|
||||||
|
LIMIT :limit
|
||||||
|
"""
|
||||||
|
),
|
||||||
|
{
|
||||||
|
"current_user_id": current_user_id,
|
||||||
|
"limit": limit,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
chat_rows = chats_result.all()
|
||||||
|
|
||||||
|
items = []
|
||||||
|
|
||||||
|
for chat_row in chat_rows:
|
||||||
|
members_result = await session.execute(
|
||||||
|
text(
|
||||||
|
"""
|
||||||
|
SELECT user_id
|
||||||
|
FROM chat_members
|
||||||
|
WHERE chat_id = :chat_id
|
||||||
|
ORDER BY user_id
|
||||||
|
"""
|
||||||
|
),
|
||||||
|
{
|
||||||
|
"chat_id": chat_row.id,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
member_ids = [
|
||||||
|
UUID(str(row.user_id))
|
||||||
|
for row in members_result
|
||||||
|
]
|
||||||
|
|
||||||
|
items.append(
|
||||||
|
Chat(
|
||||||
|
id=UUID(str(chat_row.id)),
|
||||||
|
title=chat_row.title,
|
||||||
|
member_ids=member_ids,
|
||||||
|
created_at=chat_row.created_at,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
return ChatPage(
|
||||||
|
items=items,
|
||||||
|
next_cursor=None,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
async def create_message(
|
||||||
|
session: AsyncSession,
|
||||||
|
chat_id: UUID,
|
||||||
|
current_user_id: UUID,
|
||||||
|
data: CreateMessage,
|
||||||
|
) -> Message:
|
||||||
|
membership_result = await session.execute(
|
||||||
|
text(
|
||||||
|
"""
|
||||||
|
SELECT 1
|
||||||
|
FROM chat_members
|
||||||
|
WHERE chat_id = :chat_id
|
||||||
|
AND user_id = :current_user_id
|
||||||
|
"""
|
||||||
|
),
|
||||||
|
{
|
||||||
|
"chat_id": chat_id,
|
||||||
|
"current_user_id": current_user_id,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
if membership_result.scalar_one_or_none() is None:
|
||||||
|
raise APIError(
|
||||||
|
status_code=404,
|
||||||
|
code="not_found",
|
||||||
|
message="Chat not found",
|
||||||
|
)
|
||||||
|
|
||||||
|
message_id = uuid4()
|
||||||
|
|
||||||
|
message_result = await session.execute(
|
||||||
|
text(
|
||||||
|
"""
|
||||||
|
INSERT INTO messages (
|
||||||
|
id,
|
||||||
|
chat_id,
|
||||||
|
sender_id,
|
||||||
|
text
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
:id,
|
||||||
|
:chat_id,
|
||||||
|
:sender_id,
|
||||||
|
:text
|
||||||
|
)
|
||||||
|
RETURNING
|
||||||
|
id,
|
||||||
|
chat_id,
|
||||||
|
sender_id,
|
||||||
|
text,
|
||||||
|
created_at
|
||||||
|
"""
|
||||||
|
),
|
||||||
|
{
|
||||||
|
"id": message_id,
|
||||||
|
"chat_id": chat_id,
|
||||||
|
"sender_id": current_user_id,
|
||||||
|
"text": data.text,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
row = message_result.one()
|
||||||
|
|
||||||
|
return Message(
|
||||||
|
id=UUID(str(row.id)),
|
||||||
|
chat_id=UUID(str(row.chat_id)),
|
||||||
|
sender_id=UUID(str(row.sender_id)),
|
||||||
|
text=row.text,
|
||||||
|
created_at=row.created_at,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
async def get_messages(
|
||||||
|
session: AsyncSession,
|
||||||
|
chat_id: UUID,
|
||||||
|
current_user_id: UUID,
|
||||||
|
limit: int,
|
||||||
|
cursor: str | None,
|
||||||
|
) -> MessagePage:
|
||||||
|
membership_result = await session.execute(
|
||||||
|
text(
|
||||||
|
"""
|
||||||
|
SELECT 1
|
||||||
|
FROM chat_members
|
||||||
|
WHERE chat_id = :chat_id
|
||||||
|
AND user_id = :current_user_id
|
||||||
|
"""
|
||||||
|
),
|
||||||
|
{
|
||||||
|
"chat_id": chat_id,
|
||||||
|
"current_user_id": current_user_id,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
if membership_result.scalar_one_or_none() is None:
|
||||||
|
raise APIError(
|
||||||
|
status_code=404,
|
||||||
|
code="not_found",
|
||||||
|
message="Chat not found",
|
||||||
|
)
|
||||||
|
|
||||||
|
cursor_created_at = None
|
||||||
|
cursor_message_id = None
|
||||||
|
|
||||||
|
if cursor is not None:
|
||||||
|
try:
|
||||||
|
(
|
||||||
|
cursor_chat_id,
|
||||||
|
cursor_created_at,
|
||||||
|
cursor_message_id,
|
||||||
|
) = decode_cursor(cursor)
|
||||||
|
except ValueError:
|
||||||
|
raise APIError(
|
||||||
|
status_code=400,
|
||||||
|
code="invalid_request",
|
||||||
|
message="Invalid cursor",
|
||||||
|
)
|
||||||
|
|
||||||
|
if cursor_chat_id != chat_id:
|
||||||
|
raise APIError(
|
||||||
|
status_code=400,
|
||||||
|
code="invalid_request",
|
||||||
|
message="Cursor belongs to another chat",
|
||||||
|
)
|
||||||
|
|
||||||
|
if cursor is None:
|
||||||
|
messages_result = await session.execute(
|
||||||
|
text(
|
||||||
|
"""
|
||||||
|
SELECT
|
||||||
|
id,
|
||||||
|
chat_id,
|
||||||
|
sender_id,
|
||||||
|
text,
|
||||||
|
created_at
|
||||||
|
FROM messages
|
||||||
|
WHERE chat_id = :chat_id
|
||||||
|
ORDER BY created_at, id
|
||||||
|
LIMIT :fetch_limit
|
||||||
|
"""
|
||||||
|
),
|
||||||
|
{
|
||||||
|
"chat_id": chat_id,
|
||||||
|
"fetch_limit": limit + 1,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
messages_result = await session.execute(
|
||||||
|
text(
|
||||||
|
"""
|
||||||
|
SELECT
|
||||||
|
id,
|
||||||
|
chat_id,
|
||||||
|
sender_id,
|
||||||
|
text,
|
||||||
|
created_at
|
||||||
|
FROM messages
|
||||||
|
WHERE chat_id = :chat_id
|
||||||
|
AND (created_at, id) > (
|
||||||
|
:cursor_created_at,
|
||||||
|
:cursor_message_id
|
||||||
|
)
|
||||||
|
ORDER BY created_at, id
|
||||||
|
LIMIT :fetch_limit
|
||||||
|
"""
|
||||||
|
),
|
||||||
|
{
|
||||||
|
"chat_id": chat_id,
|
||||||
|
"cursor_created_at": cursor_created_at,
|
||||||
|
"cursor_message_id": cursor_message_id,
|
||||||
|
"fetch_limit": limit + 1,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
rows = messages_result.all()
|
||||||
|
|
||||||
|
has_more = len(rows) > limit
|
||||||
|
rows = rows[:limit]
|
||||||
|
|
||||||
|
items = [
|
||||||
|
Message(
|
||||||
|
id=UUID(str(row.id)),
|
||||||
|
chat_id=UUID(str(row.chat_id)),
|
||||||
|
sender_id=UUID(str(row.sender_id)),
|
||||||
|
text=row.text,
|
||||||
|
created_at=row.created_at,
|
||||||
|
)
|
||||||
|
for row in rows
|
||||||
|
]
|
||||||
|
|
||||||
|
next_cursor = None
|
||||||
|
|
||||||
|
if has_more:
|
||||||
|
last_message = items[-1]
|
||||||
|
|
||||||
|
next_cursor = encode_cursor(
|
||||||
|
chat_id=chat_id,
|
||||||
|
created_at=last_message.created_at,
|
||||||
|
message_id=last_message.id,
|
||||||
|
)
|
||||||
|
|
||||||
|
return MessagePage(
|
||||||
|
items=items,
|
||||||
|
next_cursor=next_cursor,
|
||||||
)
|
)
|
||||||
Reference in New Issue
Block a user