36 lines
902 B
Python
36 lines
902 B
Python
from pydantic import BaseModel, Field
|
|
|
|
from app.schemas.common import NaiveDatetimeOptional
|
|
|
|
|
|
class JoinByCodeRequest(BaseModel):
|
|
invitation_code: str = Field(..., description="邀请码")
|
|
|
|
|
|
class JoinRequestHandle(BaseModel):
|
|
action: str = Field(..., pattern="^(approve|reject)$", description="approve 通过 / reject 拒绝")
|
|
note: str | None = Field(None, max_length=256, description="拒绝原因")
|
|
|
|
|
|
class JoinRequestOut(BaseModel):
|
|
id: str
|
|
team_id: str
|
|
team_name: str
|
|
user_id: str
|
|
username: str
|
|
phone: str | None = None
|
|
status: str
|
|
note: str | None = None
|
|
created_at: NaiveDatetimeOptional = None
|
|
handled_at: NaiveDatetimeOptional = None
|
|
|
|
model_config = {"from_attributes": True}
|
|
|
|
|
|
class JoinTeamInfoOut(BaseModel):
|
|
team_name: str
|
|
team_id: str
|
|
valid: bool
|
|
already_in_team: bool = False
|
|
has_pending_request: bool = False
|