- All frontend pages, labels, notices and errors; html lang=uk, uk-UA money format - Brand "Assistant System" in the top bar and page title - Backend error details returned to the UI (auth, orders, receipts, cash registers, Checkbox/CRM/NP errors) and CLI output - Tests updated for the new messages Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
45 lines
1.0 KiB
Python
45 lines
1.0 KiB
Python
"""Схемы запросов и ответов аутентификации."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import uuid
|
|
|
|
from pydantic import BaseModel, ConfigDict, EmailStr, Field
|
|
|
|
from app.db.models.user import UserRole
|
|
|
|
|
|
class LoginRequest(BaseModel):
|
|
email: EmailStr
|
|
password: str = Field(min_length=1, max_length=128)
|
|
|
|
|
|
class RefreshRequest(BaseModel):
|
|
refresh_token: str = Field(min_length=1)
|
|
|
|
|
|
class TokenPair(BaseModel):
|
|
access_token: str
|
|
refresh_token: str
|
|
token_type: str = "bearer"
|
|
expires_in: int = Field(description="Час життя access-токена в секундах")
|
|
|
|
|
|
class UserOut(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
id: uuid.UUID
|
|
email: EmailStr
|
|
full_name: str
|
|
role: UserRole
|
|
is_active: bool
|
|
|
|
|
|
class LoginResponse(TokenPair):
|
|
user: UserOut
|
|
|
|
|
|
class ChangePasswordRequest(BaseModel):
|
|
current_password: str = Field(min_length=1, max_length=128)
|
|
new_password: str = Field(min_length=10, max_length=128)
|