2026-07-20 01:33:44 +02:00
|
|
|
"""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):
|
2026-08-16 01:17:18 +02:00
|
|
|
children: list[ContactFolderTreeResponse] = Field(default_factory=list)
|
2026-07-20 01:33:44 +02:00
|
|
|
contact_count: int = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MoveContactRequest(BaseModel):
|
|
|
|
|
folder_id: str | None = None
|