feat: Kontakt-Ordner mit Drag&Drop Baum (wie KI-Chat Sidebar)
- Backend: ContactFolder model (hierarchisch, parent_id, sort_order)
- Migration 0022: contact_folders Tabelle + folder_id FK auf contacts
- CRUD Routes: /api/v1/contact-folders (list, create, update, delete, reorder)
- Move Contact API: /api/v1/contact-folders/contacts/{id}/move
- folder_id Filter in contacts list API
- Frontend: ContactFolderTree mit Baum-Struktur, Drag&Drop, Kontext-Menü
- Kontakt-Personen-Icon statt Ordner-Symbol
- ContactList Items draggable (List/Table/Cards View)
- React Query Hooks für Folder CRUD + Move Contact
- Alle 266 Frontend-Tests passing
This commit is contained in:
@@ -90,6 +90,7 @@ def _serialize_contact(c: Contact) -> dict:
|
||||
"tags": c.tags,
|
||||
"image": c.image,
|
||||
"custom": c.custom,
|
||||
"folder_id": str(c.folder_id) if c.folder_id else None,
|
||||
"default_person_id": str(c.default_person_id) if c.default_person_id else None,
|
||||
"admin_contactperson_id": str(c.admin_contactperson_id) if c.admin_contactperson_id else None,
|
||||
"created_at": c.created_at.isoformat() if c.created_at else None,
|
||||
@@ -137,11 +138,12 @@ async def list_contacts(
|
||||
page_size: int = 20,
|
||||
search: str | None = None,
|
||||
contact_type: str | None = None,
|
||||
folder_id: str | None = None,
|
||||
sort_by: str = "displayname",
|
||||
sort_order: str = "asc",
|
||||
resolved_perms: dict | None = None,
|
||||
) -> dict:
|
||||
"""List contacts with pagination, FTS search, type filter, sorting."""
|
||||
"""List contacts with pagination, FTS search, type/folder filter, sorting."""
|
||||
base = select(Contact).where(
|
||||
Contact.tenant_id == tenant_id,
|
||||
Contact.deleted_at.is_(None),
|
||||
@@ -150,6 +152,9 @@ async def list_contacts(
|
||||
if contact_type:
|
||||
base = base.where(Contact.type == contact_type)
|
||||
|
||||
if folder_id:
|
||||
base = base.where(Contact.folder_id == uuid.UUID(folder_id))
|
||||
|
||||
if search:
|
||||
base = base.where(
|
||||
Contact.search_tsv.op("@@")(func.plainto_tsquery("german", search))
|
||||
|
||||
Reference in New Issue
Block a user