29 lines
594 B
Python
29 lines
594 B
Python
"""Account schemas"""
|
|
|
|
from pydantic import BaseModel
|
|
from datetime import datetime
|
|
from typing import Optional
|
|
|
|
|
|
class AccountCreateSchema(BaseModel):
|
|
"""Schema for creating account"""
|
|
name: str
|
|
account_type: str = "card"
|
|
description: Optional[str] = None
|
|
initial_balance: float = 0.0
|
|
|
|
|
|
class AccountSchema(AccountCreateSchema):
|
|
"""Account response schema"""
|
|
id: int
|
|
family_id: int
|
|
owner_id: int
|
|
balance: float
|
|
is_active: bool
|
|
is_archived: bool
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True
|