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).
84 lines
3.0 KiB
Python
84 lines
3.0 KiB
Python
"""Audio processing template schemas."""
|
|
|
|
from datetime import datetime
|
|
from typing import List
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
from .filters import FilterInstanceSchema
|
|
|
|
|
|
class AudioProcessingTemplateCreate(BaseModel):
|
|
"""Request to create an audio processing template."""
|
|
|
|
name: str = Field(description="Template name", min_length=1, max_length=100)
|
|
filters: List[FilterInstanceSchema] = Field(
|
|
default_factory=list, description="Ordered list of audio 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 AudioProcessingTemplateUpdate(BaseModel):
|
|
"""Request to update an audio processing 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 audio 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 AudioProcessingTemplateResponse(BaseModel):
|
|
"""Audio processing template information response."""
|
|
|
|
id: str = Field(description="Template ID")
|
|
name: str = Field(description="Template name")
|
|
filters: List[FilterInstanceSchema] = Field(
|
|
description="Ordered list of audio 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 AudioProcessingTemplateListResponse(BaseModel):
|
|
"""List of audio processing templates response."""
|
|
|
|
templates: List[AudioProcessingTemplateResponse] = Field(
|
|
description="List of audio processing templates"
|
|
)
|
|
count: int = Field(description="Number of templates")
|