buildersai / app /schemas /auth.py
Kushal
Initial deployment: FastAPI backend with Docker
f3997d4
Raw
History Blame Contribute Delete
838 Bytes
from pydantic import BaseModel, EmailStr
from typing import Optional
from datetime import datetime
class UserCreate(BaseModel):
"""Schema for user registration."""
email: EmailStr
password: str
name: Optional[str] = None
class UserLogin(BaseModel):
"""Schema for user login."""
email: EmailStr
password: str
class GoogleAuthRequest(BaseModel):
"""Schema for Google OAuth."""
code: str
class UserResponse(BaseModel):
"""Schema for user response."""
id: str
email: str
name: Optional[str]
is_admin: bool = False
created_at: datetime
class Config:
from_attributes = True
class TokenResponse(BaseModel):
"""Schema for authentication token response."""
access_token: str
refresh_token: str
token_type: str = "bearer"
user: UserResponse