31 lines
673 B
Python
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
|