forked from mtusi2026/mtusi2026lab2
23 lines
683 B
Python
23 lines
683 B
Python
import uuid
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
from typing import List
|
|
|
|
class CreateUserRequest(BaseModel):
|
|
model_config = ConfigDict(extra="forbid")
|
|
|
|
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 CreateChatRequest(BaseModel):
|
|
model_config = ConfigDict(extra="forbid")
|
|
|
|
title: str = Field(min_length=1, max_length=100)
|
|
member_ids: List[str] = Field(min_length=1, max_length=100)
|
|
|
|
|
|
class SendMessageRequest(BaseModel):
|
|
model_config = ConfigDict(extra="forbid")
|
|
|
|
text: str = Field(min_length=1, max_length=4000) |