Spaces:
Sleeping
Sleeping
File size: 1,199 Bytes
b2be963 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | from datetime import datetime
from typing import Optional
from pydantic import BaseModel, EmailStr, Field
class RegisterRequest(BaseModel):
name: str = Field(..., min_length=2, max_length=255)
email: str = Field(..., max_length=255)
password: str = Field(..., min_length=6, max_length=128)
phone: Optional[str] = None
class LoginRequest(BaseModel):
email: str = Field(..., max_length=255)
password: str = Field(..., min_length=1, max_length=128)
class GoogleLoginRequest(BaseModel):
credential: str = Field(..., description="Google ID token from frontend")
class RefreshRequest(BaseModel):
refresh_token: str
class TokenResponse(BaseModel):
access_token: str
refresh_token: str
token_type: str = "bearer"
class UserResponse(BaseModel):
id: int
name: str
email: str
phone: Optional[str] = None
role: str
avatar_url: Optional[str] = None
auth_provider: str
created_at: datetime
model_config = {"from_attributes": True}
class AuthResponse(BaseModel):
isSuccess: bool
value: Optional[dict] = None
error: Optional[str] = None
statusCode: int
|