- Add `tags: List[str]` field to all 13 entity types (devices, output targets, CSS sources, picture sources, audio sources, value sources, sync clocks, automations, scene presets, capture/audio/PP/pattern templates) - Update all stores, schemas, and route handlers for tag CRUD - Add GET /api/v1/tags endpoint aggregating unique tags across all stores - Create TagInput component with chip display, autocomplete dropdown, keyboard navigation, and API-backed suggestions - Display tag chips on all entity cards (searchable via existing text filter) - Add tag input to all 14 editor modals with dirty check support - Add CSS styles and i18n keys (en/ru/zh) for tag UI - Also includes code review fixes: thread safety, perf, store dedup Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
57 lines
1.7 KiB
Python
57 lines
1.7 KiB
Python
"""Scene preset API schemas."""
|
|
|
|
from datetime import datetime
|
|
from typing import List, Optional
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class TargetSnapshotSchema(BaseModel):
|
|
target_id: str
|
|
running: bool = False
|
|
color_strip_source_id: str = ""
|
|
brightness_value_source_id: str = ""
|
|
fps: int = 30
|
|
|
|
|
|
class ScenePresetCreate(BaseModel):
|
|
"""Create a scene preset by capturing current state."""
|
|
|
|
name: str = Field(description="Preset name", min_length=1, max_length=100)
|
|
description: str = Field(default="", max_length=500)
|
|
target_ids: Optional[List[str]] = Field(None, description="Target IDs to capture (all if omitted)")
|
|
tags: List[str] = Field(default_factory=list, description="User-defined tags")
|
|
|
|
|
|
class ScenePresetUpdate(BaseModel):
|
|
"""Update scene preset metadata and optionally change which targets are included."""
|
|
|
|
name: Optional[str] = Field(None, min_length=1, max_length=100)
|
|
description: Optional[str] = Field(None, max_length=500)
|
|
order: Optional[int] = None
|
|
target_ids: Optional[List[str]] = Field(None, description="Update target list: keep state for existing, capture fresh for new, drop removed")
|
|
tags: Optional[List[str]] = None
|
|
|
|
|
|
class ScenePresetResponse(BaseModel):
|
|
"""Scene preset with full snapshot data."""
|
|
|
|
id: str
|
|
name: str
|
|
description: str
|
|
targets: List[TargetSnapshotSchema]
|
|
order: int
|
|
tags: List[str] = Field(default_factory=list, description="User-defined tags")
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
|
|
class ScenePresetListResponse(BaseModel):
|
|
presets: List[ScenePresetResponse]
|
|
count: int
|
|
|
|
|
|
class ActivateResponse(BaseModel):
|
|
status: str = Field(description="'activated' or 'partial'")
|
|
errors: List[str] = Field(default_factory=list)
|