34 lines
694 B
Python
34 lines
694 B
Python
"""Pydantic schemas for authentication endpoints."""
|
|
|
|
import uuid
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class LoginRequest(BaseModel):
|
|
"""Body for the login endpoint (unused directly — we rely on
|
|
``OAuth2PasswordRequestForm``, but kept for documentation / testing)."""
|
|
|
|
username: str
|
|
password: str
|
|
|
|
|
|
class TokenResponse(BaseModel):
|
|
"""Response returned after a successful login."""
|
|
|
|
access_token: str
|
|
token_type: str = "bearer"
|
|
|
|
|
|
class UserOut(BaseModel):
|
|
"""Public representation of a user (no password hash)."""
|
|
|
|
id: uuid.UUID
|
|
username: str
|
|
email: str | None = None
|
|
role: str
|
|
is_active: bool
|
|
|
|
class Config:
|
|
from_attributes = True
|