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

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,43 @@
from datetime import datetime, date
from decimal import Decimal
from pydantic import BaseModel, Field
from app.schemas.category import CategoryOut
from app.schemas.currency import CurrencyOut
class BudgetCreate(BaseModel):
category_id: int
name: str = Field(..., max_length=200)
amount: Decimal = Field(..., gt=0)
currency_id: int
period_type: str = Field(..., pattern="^(monthly|weekly|yearly|custom)$")
start_date: date
end_date: date | None = None
is_active: bool = True
class BudgetUpdate(BaseModel):
name: str | None = None
amount: Decimal | None = Field(None, gt=0)
period_type: str | None = None
end_date: date | None = None
is_active: bool | None = None
class BudgetOut(BaseModel):
id: int
user_id: int
category_id: int
category: CategoryOut
name: str
amount: Decimal
currency_id: int
currency: CurrencyOut
period_type: str
start_date: date
end_date: date | None = None
is_active: bool
created_at: datetime
spent: Decimal | None = None # computed field
model_config = {"from_attributes": True}