Files
finance_bot/app/schemas/budget.py
2025-12-10 22:09:31 +09:00

30 lines
640 B
Python

"""Budget schemas"""
from pydantic import BaseModel
from datetime import datetime
from typing import Optional
class BudgetCreateSchema(BaseModel):
"""Schema for creating budget"""
name: str
limit_amount: float
period: str = "monthly"
alert_threshold: float = 80.0
category_id: Optional[int] = None
start_date: datetime
class BudgetSchema(BudgetCreateSchema):
"""Budget response schema"""
id: int
family_id: int
spent_amount: float
is_active: bool
end_date: Optional[datetime] = None
created_at: datetime
updated_at: datetime
class Config:
from_attributes = True