Обновление приложения

This commit is contained in:
2026-04-28 22:37:19 +03:00
parent 7d00cf062e
commit 52594b5dc6
99 changed files with 5736 additions and 1052 deletions

View File

@@ -0,0 +1,48 @@
from datetime import datetime, date
from decimal import Decimal
from pydantic import BaseModel, Field
class CurrencyCreate(BaseModel):
code: str = Field(..., min_length=3, max_length=3)
name: str = Field(..., max_length=100)
symbol: str | None = Field(None, max_length=10)
is_active: bool = True
class CurrencyUpdate(BaseModel):
name: str | None = Field(None, max_length=100)
symbol: str | None = Field(None, max_length=10)
is_active: bool | None = None
class CurrencyOut(BaseModel):
id: int
code: str
name: str
symbol: str | None = None
is_active: bool
model_config = {"from_attributes": True}
class ExchangeRateCreate(BaseModel):
currency_from_id: int
currency_to_id: int
rate: Decimal = Field(..., gt=0)
rate_date: date
source: str | None = None
class ExchangeRateOut(BaseModel):
id: int
currency_from_id: int
currency_to_id: int
rate: Decimal
rate_date: date
source: str | None = None
created_at: datetime
currency_from: CurrencyOut
currency_to: CurrencyOut
model_config = {"from_attributes": True}