я надеюсь я исправила поставьте зачет
Skeleton contracts / contracts (pull_request) Canceled after 0s

This commit is contained in:
2026-10-17 01:21:46 +03:00
parent dbe0a5ea7d
commit 5e89a36878
11 changed files with 16 additions and 20 deletions
+3 -5
View File
@@ -211,17 +211,15 @@ def create_chat(auth: Auth = Depends(authenticated), body: RawBody = Depends(raw
chat = repo.create_chat(conn, auth.user_id, title, members)
return repo.chat_json(chat)
@app.get("/api/v1/chats")
def list_chats(request: Request, auth: Auth = Depends(authenticated)):
limit = validation.limit_param(request.query_params)
raw = request.query_params.get("cursor")
after = cursor.decode(raw, "chats", auth.user_id) if raw else None
after = cursor.decode(raw, "chats", auth.user_id) if raw is not None else None
with db.connection() as conn:
items, nxt = repo.list_chats(conn, auth.user_id, after, limit)
return {"items": items, "next_cursor": nxt}
@app.get("/api/v1/chats/{chat_id}")
def get_chat(chat_id: str, auth: Auth = Depends(authenticated)):
cid = validation.require_uuid(chat_id, "chat_id")
@@ -251,9 +249,9 @@ def list_messages(chat_id: str, request: Request, auth: Auth = Depends(authentic
cid = validation.require_uuid(chat_id, "chat_id")
limit = validation.limit_param(request.query_params)
raw = request.query_params.get("cursor")
after = cursor.decode(raw, "messages", cid) if raw else None
after = cursor.decode(raw, "messages", cid) if raw is not None else None
with db.connection() as conn:
if not repo.is_member(conn, cid, auth.user_id):
raise not_found()
items, nxt = repo.list_messages(conn, cid, after, limit)
return {"items": items, "next_cursor": nxt}
return {"items": items, "next_cursor": nxt}