mirror of
https://github.com/stardrophere/InsightRadar.git
synced 2026-06-06 03:07:50 +08:00
login+ai cluster
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user