схема бд и компоуз с постгресс
This commit is contained in:
+40
@@ -0,0 +1,40 @@
|
||||
from pydantic import BaseModel, Field
|
||||
import uuid
|
||||
|
||||
class User(BaseModel):
|
||||
id: str
|
||||
username: str = Field(pattern=r"^[a-z0-9_]{3,32}$")
|
||||
display_name: str = Field(min_length=1, max_length=100)
|
||||
created_at: str
|
||||
|
||||
class CreateUser(BaseModel):
|
||||
username: str = Field(pattern=r"^[a-z0-9_]{3,32}$")
|
||||
display_name: str = Field(min_length=1, max_length=100)
|
||||
|
||||
class Chat(BaseModel):
|
||||
id: str
|
||||
title: str = Field(min_length=1, max_length=100)
|
||||
member_ids: list[str] = Field(min_length=1, max_length=100)
|
||||
created_at: str
|
||||
|
||||
class CreateChat(BaseModel):
|
||||
title: str = Field(min_length=1, max_length=100)
|
||||
member_ids: list[str] = Field(min_length=1, max_length=100)
|
||||
|
||||
class ChatPage(BaseModel):
|
||||
items: list[Chat]
|
||||
next_cursor: str | None
|
||||
|
||||
class CreateMessage(BaseModel):
|
||||
text: str = Field(min_length=1, max_length=4000)
|
||||
|
||||
class Message(BaseModel):
|
||||
id: str
|
||||
chat_id: str
|
||||
sender_id: str
|
||||
text: str = Field(min_length=1, max_length=4000)
|
||||
created_at: str
|
||||
|
||||
class MessagePage(BaseModel):
|
||||
items: list[Message]
|
||||
next_cursor: str | None
|
||||
Reference in New Issue
Block a user