table_game/backend/app/schemas/user_info.py
2025-03-10 08:35:19 +08:00

60 lines
1.4 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from pydantic import BaseModel, EmailStr, constr, validator, Field
from typing import Optional
from datetime import datetime
from typing import Literal
class UserRangeQueryRequest(BaseModel):
token: str
start: int
end: int
class UserInfo(BaseModel):
user_id: int
username: str
points: int
gender: Optional[str]
phone_number: Optional[str]
email: Optional[str]
user_type: str
created_at: Optional[datetime]
updated_at: Optional[datetime]
class UserDeleteRequest(BaseModel):
token: str
uid: int
class UserUpdateRequest(BaseModel):
token: str
uid: int
username: Optional[str] = None
email: Optional[EmailStr] = None
phone_number: Optional[str] = None # 使用 str 类型
gender: Optional[str] = None # 'male', 'female', 'other'
user_type: Optional[str] = None # 'admin' or 'player'
class TotalNumberOfUsers(BaseModel):
token: str
class UserQueryRequest(BaseModel):
token: str
query_mode: Literal["phone_number", "email", "username", "uid"] # 限定模式类型
query_value: str = Field(..., description="查询值支持电话号码、邮箱、用户名或用户ID")
class UserPasswordUpdateRequest(BaseModel):
token: str
uid: int
new_password: str
class UserPointsUpdateRequest(BaseModel):
token: str
uid: int
points: int
reason: str
class RegisterRequest(BaseModel):
phone_number: str
code: str
username: str
password: str