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

31 lines
673 B
Python

"""Goal schemas"""
from pydantic import BaseModel
from datetime import datetime
from typing import Optional
class GoalCreateSchema(BaseModel):
"""Schema for creating goal"""
name: str
description: Optional[str] = None
target_amount: float
priority: int = 0
target_date: Optional[datetime] = None
account_id: Optional[int] = None
class GoalSchema(GoalCreateSchema):
"""Goal response schema"""
id: int
family_id: int
current_amount: float
is_active: bool
is_completed: bool
created_at: datetime
updated_at: datetime
completed_at: Optional[datetime] = None
class Config:
from_attributes = True