新增管理员创建用户接口 POST /admin/users,创建后邮箱自动确认

This commit is contained in:
2026-07-26 02:20:03 +08:00
parent 8149505f1b
commit 0776e91735
3 changed files with 116 additions and 0 deletions
+15
View File
@@ -242,6 +242,21 @@ class AdminUserUpdateIn(BaseModel):
return self
class AdminCreateUserIn(BaseModel):
email: EmailStr
password: str = Field(min_length=8, max_length=128)
username: str = Field(min_length=2, max_length=32)
role: Role = "user"
@field_validator("username")
@classmethod
def strip_username(cls, value: str) -> str:
value = value.strip()
if len(value) < 2:
raise ValueError("昵称至少需要 2 个字符")
return value
class AdminCloudStatusIn(BatchIdsIn):
status: CloudStatus