merge main

This commit is contained in:
2026-07-06 15:16:30 +08:00
31 changed files with 2303 additions and 584 deletions
+2
View File
@@ -29,6 +29,8 @@ class TeamOut(TeamBase):
member_count: int = 0
created_at: NaiveDatetime
updated_at: NaiveDatetimeOptional = None
manager_id: str | None = None
manager_name: str | None = None
model_config = {"from_attributes": True}
@@ -0,0 +1,22 @@
from pydantic import BaseModel, Field
from app.schemas.common import NaiveDatetimeOptional
class TeamInvitationCreate(BaseModel):
max_uses: int | None = Field(None, ge=1, description="最大使用次数,null 表示不限")
expires_at: str | None = Field(None, description="过期时间 ISO 格式,null 表示永不过期")
class TeamInvitationOut(BaseModel):
id: str
team_id: str
code: str
status: str
max_uses: int | None = None
use_count: int = 0
expires_at: NaiveDatetimeOptional = None
invite_link: str = ""
created_at: NaiveDatetimeOptional = None
model_config = {"from_attributes": True}
@@ -0,0 +1,33 @@
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
model_config = {"from_attributes": True}
class JoinTeamInfoOut(BaseModel):
team_name: str
team_id: str
valid: bool
already_in_team: bool = False
+37
View File
@@ -0,0 +1,37 @@
from pydantic import BaseModel, Field
from app.schemas.common import NaiveDatetime
class SetManagerRequest(BaseModel):
user_id: str | None = Field(None, description="设为管理人的前台用户ID;传 null 表示取消管理人")
class TeamMemberOut(BaseModel):
id: str
username: str
phone: str | None = None
credits: float
is_active: bool = True
joined_at: NaiveDatetime
model_config = {"from_attributes": True}
class ManagerTransferRequest(BaseModel):
target_user_id: str = Field(..., description="接收积分的成员用户ID")
amount: float = Field(gt=0, description="转账积分数量(正数)")
description: str | None = Field(None, max_length=256, description="转账说明")
class ManagedTeamOut(BaseModel):
id: str
name: str
code: str | None = None
description: str | None = None
status: str
member_count: int = 0
manager_id: str | None = None
manager_name: str | None = None
model_config = {"from_attributes": True}
+3
View File
@@ -16,5 +16,8 @@ class UserOut(BaseModel):
must_set_password: bool = False
resource_capacity: ResourceCapacityUsageOut | None = None
private_portrait_image_limit: int = 5
team_id: str | None = None
team_name: str | None = None
is_team_manager: bool = False
model_config = {"from_attributes": True}