login+ai cluster

This commit is contained in:
stardrophere
2026-03-11 01:33:21 +08:00
parent 9fa07cfb07
commit 8ed819a580
39 changed files with 3392 additions and 610 deletions
+56
View File
@@ -0,0 +1,56 @@
from datetime import datetime
from typing import Optional
from pydantic import BaseModel, ConfigDict, Field
from app.models.models import GenderType
EMAIL_PATTERN = r"^[^@\s]+@[^@\s]+\.[^@\s]+$"
class RegisterCodeSendRequest(BaseModel):
email: str = Field(..., max_length=150, pattern=EMAIL_PATTERN)
class LoginCodeSendRequest(BaseModel):
email: str = Field(..., max_length=150, pattern=EMAIL_PATTERN)
class RegisterRequest(BaseModel):
email: str = Field(..., max_length=150, pattern=EMAIL_PATTERN)
password: str = Field(..., min_length=8, max_length=128)
verification_code: str = Field(..., pattern=r"^\d{6}$")
nickname: Optional[str] = Field(default=None, max_length=100)
class LoginRequest(BaseModel):
email: str = Field(..., max_length=150, pattern=EMAIL_PATTERN)
password: str = Field(..., min_length=8, max_length=128)
class LoginWithCodeRequest(BaseModel):
email: str = Field(..., max_length=150, pattern=EMAIL_PATTERN)
verification_code: str = Field(..., pattern=r"^\d{6}$")
class UserProfileResponse(BaseModel):
id: int
email: str
nickname: Optional[str]
avatar_url: Optional[str]
gender: GenderType
created_at: datetime
model_config = ConfigDict(from_attributes=True)
class AuthTokenResponse(BaseModel):
access_token: str
token_type: str = "bearer"
expires_in: int
user: UserProfileResponse
class MessageResponse(BaseModel):
message: str