feat(lab3): add nginx load balancing, scaling, idempotency and failover script

This commit is contained in:
2026-10-23 03:54:09 +03:00
parent 0ab3a341aa
commit a99e4c72c6
21 changed files with 973 additions and 0 deletions
+55
View File
@@ -0,0 +1,55 @@
from pydantic import BaseModel, Field, ConfigDict
from typing import List, Optional
from datetime import datetime
class User(BaseModel):
model_config = ConfigDict(from_attributes=True)
id: str
username: str
display_name: str
created_at: str
class CreateUser(BaseModel):
username: str = Field(..., min_length=3, max_length=32, pattern="^[a-z0-9_]+$")
display_name: str = Field(..., min_length=1, max_length=100)
password: str = Field(..., min_length=12, max_length=128)
class Session(BaseModel):
model_config = ConfigDict(from_attributes=True)
token: str
token_type: str
expires_at: datetime
user: User
class Chat(BaseModel):
model_config = ConfigDict(from_attributes=True)
id: str
title: str
member_ids: List[str]
created_at: str
class CreateChat(BaseModel):
title: str = Field(..., min_length=1, max_length=100)
member_ids: List[str]
class ChatPage(BaseModel):
items: List[Chat]
next_cursor: Optional[str] = None
class Message(BaseModel):
model_config = ConfigDict(from_attributes=True)
id: str
chat_id: str
sender_id: str
text: str
created_at: str
class CreateMessage(BaseModel):
text: str = Field(..., min_length=1, max_length=4000)
class MessagePage(BaseModel):
items: List[Message]
next_cursor: Optional[str] = None
class ErrorResponse(BaseModel):
error: dict