init commit
This commit is contained in:
41
.history/app/schemas/family_20251210202255.py
Normal file
41
.history/app/schemas/family_20251210202255.py
Normal file
@@ -0,0 +1,41 @@
|
||||
"""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
|
||||
Reference in New Issue
Block a user