Реализация Лабораторной 2: PostgreSQL, Valkey, кэширование
Skeleton contracts / contracts (pull_request) Failing after 35s

This commit is contained in:
2026-10-09 15:02:48 +03:00
parent 65003b6119
commit cca293dcb1
19 changed files with 966 additions and 24 deletions
+57
View File
@@ -0,0 +1,57 @@
from pydantic import BaseModel, Field
from datetime import datetime
from typing import List, Optional
import uuid
class User(BaseModel):
id: uuid.UUID
username: str = Field(..., pattern=r"^[a-z0-9_]{3,32}$")
display_name: str = Field(..., min_length=1, max_length=100)
created_at: datetime
class CreateUser(BaseModel):
username: str = Field(..., pattern=r"^[a-z0-9_]{3,32}$")
display_name: str = Field(..., min_length=1, max_length=100)
password: str = Field(..., min_length=12, max_length=128)
class Session(BaseModel):
token: str = Field(..., min_length=32)
token_type: str = "Bearer"
expires_at: datetime
user: User
class Chat(BaseModel):
id: uuid.UUID
title: str = Field(..., min_length=1, max_length=100)
member_ids: List[uuid.UUID] = Field(..., min_length=1, max_length=100)
created_at: datetime
class CreateChat(BaseModel):
title: str = Field(..., min_length=1, max_length=100)
member_ids: List[uuid.UUID] = Field(..., min_length=1, max_length=100)
class Message(BaseModel):
id: uuid.UUID
chat_id: uuid.UUID
sender_id: uuid.UUID
text: str = Field(..., min_length=1, max_length=4000)
created_at: datetime
class CreateMessage(BaseModel):
text: str = Field(..., min_length=1, max_length=4000)
class ChatPage(BaseModel):
items: List[Chat]
next_cursor: Optional[str] = None
class MessagePage(BaseModel):
items: List[Message]
next_cursor: Optional[str] = None
class ErrorDetail(BaseModel):
code: str
message: str
request_id: str
class ErrorResponse(BaseModel):
error: ErrorDetail