Some checks failed
build-images / web (push) Has been cancelled
vision2026-ci / Python SDK resource tests (push) Has been cancelled
build-images / api (push) Has been cancelled
build-images / worker-gpu (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (comfy-workflow-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (effects-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (eventbus-types) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (growth-analytics) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (provider-adapter-kit) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (publishing-connectors) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (render-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (shot-template-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (trends-schema) (push) Has been cancelled
vision2026-ci / Desktop engine crates (test + clippy + fmt) (push) Has been cancelled
codeql / Analyze (javascript-typescript) (push) Has been cancelled
codeql / Analyze (python) (push) Has been cancelled
perf / API hot-path micro-smoke (budgeted) (push) Has been cancelled
perf / Desktop engine crates (release build check) (push) Has been cancelled
vision2026-ci / API phase modules (ruff + pytest) (push) Has been cancelled
vision2026-ci / Alembic upgrade + drift check (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (caption-engine) (push) Has been cancelled
Paid, hosted product at menivor.com, now retired as a company project. Fresh squashed history of the cleaned working tree (secret-scanned, no .env, no customer data, no outreach logs). Built on MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
49 lines
1.9 KiB
Python
49 lines
1.9 KiB
Python
"""Shot-template instantiation persistence (P6/P10).
|
|
|
|
The system genre templates are code-defined (``app.domains.templates.presets``);
|
|
this table records each **instantiation** — which template version a creator ran,
|
|
with what inputs, producing which reel — for reproducibility and genre analytics
|
|
(which formats convert). Custom user templates reuse the same ``ShotTemplateDef``
|
|
shape later; this is the durable audit + analytics substrate.
|
|
|
|
Registered on ``Base.metadata`` via ``migrations/env.py``. Nullability follows the
|
|
repo rule.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import uuid
|
|
from datetime import datetime
|
|
|
|
from sqlalchemy import JSON, DateTime, ForeignKey, Integer, String, func, text
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from app.models.db.base import Base
|
|
|
|
|
|
def _uuid() -> str:
|
|
return uuid.uuid4().hex
|
|
|
|
|
|
class TemplateInstance(Base):
|
|
"""A compiled instantiation of a genre template into a reel draft/job."""
|
|
|
|
__tablename__ = "template_instances"
|
|
|
|
id: Mapped[str] = mapped_column(String(32), primary_key=True, default=_uuid)
|
|
user_id: Mapped[str] = mapped_column(ForeignKey("users.id"), index=True, nullable=False)
|
|
template_slug: Mapped[str] = mapped_column(String(80), index=True, nullable=False)
|
|
template_version: Mapped[str] = mapped_column(
|
|
String(20), default="", server_default=text("''"), nullable=False
|
|
)
|
|
# The validated inputs used (opaque, grows without a migration).
|
|
inputs: Mapped[dict] = mapped_column(JSON, default=dict)
|
|
duration_s: Mapped[int] = mapped_column(Integer, default=0, server_default=text("0"), nullable=False)
|
|
# The reel job this instantiation produced (empty until dispatched).
|
|
reel_job_id: Mapped[str] = mapped_column(
|
|
String(64), default="", server_default=text("''"), nullable=False
|
|
)
|
|
created_at: Mapped[datetime] = mapped_column(
|
|
DateTime(timezone=True), server_default=func.now(), index=True, nullable=False
|
|
)
|