888f8fd16e
ruff --select UP007,UP045 --fix converted ~1760 sites across the backend: `Optional[T]` → `T | None`, `Union[X, Y]` → `X | Y`. The remaining module-level alias targets that ruff conservatively skips (BindableFloatInput, ColorList, DeviceConfig) were converted by hand earlier in the pass. black -formatted the result so the wider unions fit cleanly under the 100-char line budget. pyproject.toml now sets [tool.ruff.lint] extend-select = ["UP007", "UP045"] so future legacy imports fire CI on every push. The pre-commit ruff hook was bumped from v0.8.0 -> v0.15.12 to recognise UP045 (split off from UP007 in v0.13).
91 lines
3.3 KiB
Python
91 lines
3.3 KiB
Python
"""Postprocessing template schemas."""
|
|
|
|
from datetime import datetime
|
|
from typing import List
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
from .filters import FilterInstanceSchema
|
|
|
|
|
|
class PostprocessingTemplateCreate(BaseModel):
|
|
"""Request to create a postprocessing template."""
|
|
|
|
name: str = Field(description="Template name", min_length=1, max_length=100)
|
|
filters: List[FilterInstanceSchema] = Field(
|
|
default_factory=list, description="Ordered list of filter instances"
|
|
)
|
|
description: str | None = Field(None, description="Template description", max_length=500)
|
|
tags: List[str] = Field(default_factory=list, description="User-defined tags")
|
|
icon: str | None = Field(
|
|
None,
|
|
max_length=64,
|
|
description="Icon id from the curated icon library. Pass empty string to clear.",
|
|
)
|
|
icon_color: str | None = Field(
|
|
None,
|
|
max_length=32,
|
|
description="Optional CSS color override for the icon. Empty/null inherits the channel accent.",
|
|
)
|
|
|
|
|
|
class PostprocessingTemplateUpdate(BaseModel):
|
|
"""Request to update a postprocessing template."""
|
|
|
|
name: str | None = Field(None, description="Template name", min_length=1, max_length=100)
|
|
filters: List[FilterInstanceSchema] | None = Field(
|
|
None, description="Ordered list of filter instances"
|
|
)
|
|
description: str | None = Field(None, description="Template description", max_length=500)
|
|
tags: List[str] | None = None
|
|
icon: str | None = Field(
|
|
None,
|
|
max_length=64,
|
|
description="Icon id from the curated icon library. Pass empty string to clear.",
|
|
)
|
|
icon_color: str | None = Field(
|
|
None,
|
|
max_length=32,
|
|
description="Optional CSS color override for the icon. Empty/null inherits the channel accent.",
|
|
)
|
|
|
|
|
|
class PostprocessingTemplateResponse(BaseModel):
|
|
"""Postprocessing template information response."""
|
|
|
|
id: str = Field(description="Template ID")
|
|
name: str = Field(description="Template name")
|
|
filters: List[FilterInstanceSchema] = Field(description="Ordered list of filter instances")
|
|
tags: List[str] = Field(default_factory=list, description="User-defined tags")
|
|
created_at: datetime = Field(description="Creation timestamp")
|
|
updated_at: datetime = Field(description="Last update timestamp")
|
|
description: str | None = Field(None, description="Template description")
|
|
icon: str | None = Field(
|
|
None,
|
|
max_length=64,
|
|
description="Icon id from the curated icon library. Pass empty string to clear.",
|
|
)
|
|
icon_color: str | None = Field(
|
|
None,
|
|
max_length=32,
|
|
description="Optional CSS color override for the icon. Empty/null inherits the channel accent.",
|
|
)
|
|
|
|
|
|
class PostprocessingTemplateListResponse(BaseModel):
|
|
"""List of postprocessing templates response."""
|
|
|
|
templates: List[PostprocessingTemplateResponse] = Field(
|
|
description="List of postprocessing templates"
|
|
)
|
|
count: int = Field(description="Number of templates")
|
|
|
|
|
|
class PPTemplateTestRequest(BaseModel):
|
|
"""Request to test a postprocessing template against a source stream."""
|
|
|
|
source_stream_id: str = Field(description="ID of the source picture source to capture from")
|
|
capture_duration: float = Field(
|
|
default=5.0, ge=1.0, le=30.0, description="Duration to capture in seconds"
|
|
)
|