34 lines
826 B
Python
34 lines
826 B
Python
|
|
"""Contact folder schemas — CRUD for hierarchical contact folders."""
|
||
|
|
|
||
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
from pydantic import BaseModel, Field
|
||
|
|
|
||
|
|
|
||
|
|
class ContactFolderCreate(BaseModel):
|
||
|
|
name: str = Field(..., min_length=1, max_length=255)
|
||
|
|
parent_id: str | None = None
|
||
|
|
|
||
|
|
|
||
|
|
class ContactFolderUpdate(BaseModel):
|
||
|
|
name: str | None = Field(None, min_length=1, max_length=255)
|
||
|
|
parent_id: str | None = None
|
||
|
|
sort_order: int | None = None
|
||
|
|
|
||
|
|
|
||
|
|
class ContactFolderResponse(BaseModel):
|
||
|
|
id: str
|
||
|
|
name: str
|
||
|
|
parent_id: str | None = None
|
||
|
|
user_id: str
|
||
|
|
sort_order: int = 0
|
||
|
|
|
||
|
|
|
||
|
|
class ContactFolderTreeResponse(ContactFolderResponse):
|
||
|
|
children: list["ContactFolderTreeResponse"] = Field(default_factory=list)
|
||
|
|
contact_count: int = 0
|
||
|
|
|
||
|
|
|
||
|
|
class MoveContactRequest(BaseModel):
|
||
|
|
folder_id: str | None = None
|