26 lines
865 B
Python
26 lines
865 B
Python
from __future__ import annotations
|
|
|
|
import uuid
|
|
|
|
from sqlalchemy import Boolean, ForeignKey, JSON, String, Text
|
|
from sqlalchemy.dialects.postgresql import UUID
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from cpv3.db.base import Base, BaseModelMixin
|
|
|
|
|
|
class CaptionPreset(Base, BaseModelMixin):
|
|
__tablename__ = "caption_presets"
|
|
|
|
user_id: Mapped[uuid.UUID | None] = mapped_column(
|
|
UUID(as_uuid=True),
|
|
ForeignKey("users.id", ondelete="CASCADE"),
|
|
nullable=True,
|
|
index=True,
|
|
)
|
|
name: Mapped[str] = mapped_column(String(128))
|
|
description: Mapped[str | None] = mapped_column(Text, nullable=True)
|
|
is_system: Mapped[bool] = mapped_column(Boolean, default=False)
|
|
style_config: Mapped[dict] = mapped_column(JSON, nullable=False)
|
|
preview_url: Mapped[str | None] = mapped_column(String(512), nullable=True)
|