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

42 lines
875 B
Python

"""Family schemas"""
from pydantic import BaseModel
from datetime import datetime
from typing import Optional, List
class FamilyMemberSchema(BaseModel):
"""Family member schema"""
id: int
user_id: int
role: str
can_edit_budget: bool
can_manage_members: bool
joined_at: datetime
class Config:
from_attributes = True
class FamilyCreateSchema(BaseModel):
"""Schema for creating family"""
name: str
description: Optional[str] = None
currency: str = "RUB"
notification_level: str = "all"
accounting_period: str = "month"
class FamilySchema(FamilyCreateSchema):
"""Family response schema"""
id: int
owner_id: int
invite_code: str
is_active: bool
created_at: datetime
updated_at: datetime
members: List[FamilyMemberSchema] = []
class Config:
from_attributes = True