finance-buddy / models /budget.py
lucifer7210's picture
Upload 40 files
8809c2b verified
raw
history blame contribute delete
957 Bytes
from pydantic import BaseModel, Field
from typing import Dict, Optional
class Budget(BaseModel):
category: str
limit: float
spent: float = 0.0
class Config:
schema_extra = {
"example": {
"category": "Food & Dining",
"limit": 8000.0,
"spent": 4500.0
}
}
class Budgets(BaseModel):
budgets: Dict[str, Budget]
class Config:
schema_extra = {
"example": {
"budgets": {
"Food & Dining": {
"category": "Food & Dining",
"limit": 8000.0,
"spent": 4500.0
},
"Transportation": {
"category": "Transportation",
"limit": 3000.0,
"spent": 1500.0
}
}
}
}