Files
resolutionflow/backend/app/schemas/tree.py
Michael Chihlas db0b05eba7 Add is_default flag for system trees
- Add is_default column to trees table
- Default trees have no author and are visible to all users
- Only admins can create default trees
- Update seed script to mark seeded trees as default
- Update seed script to use CLI auth instead of creating seed user

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 01:32:10 -05:00

56 lines
1.4 KiB
Python

from datetime import datetime
from typing import Optional, Any
from uuid import UUID
from pydantic import BaseModel, Field
class TreeBase(BaseModel):
name: str = Field(..., min_length=1, max_length=255)
description: Optional[str] = None
category: Optional[str] = Field(None, max_length=100)
class TreeCreate(TreeBase):
tree_structure: dict[str, Any] = Field(..., description="The decision tree structure in JSON format")
is_default: bool = Field(False, description="Mark as a default/system tree (admin only)")
class TreeUpdate(BaseModel):
name: Optional[str] = Field(None, min_length=1, max_length=255)
description: Optional[str] = None
category: Optional[str] = Field(None, max_length=100)
tree_structure: Optional[dict[str, Any]] = None
is_active: Optional[bool] = None
class TreeResponse(TreeBase):
id: UUID
tree_structure: dict[str, Any]
author_id: Optional[UUID] = None
team_id: Optional[UUID] = None
is_active: bool
is_default: bool
version: int
created_at: datetime
updated_at: datetime
usage_count: int
class Config:
from_attributes = True
class TreeListResponse(BaseModel):
id: UUID
name: str
description: Optional[str] = None
category: Optional[str] = None
is_active: bool
is_default: bool
version: int
usage_count: int
created_at: datetime
updated_at: datetime
class Config:
from_attributes = True