419cc3fb6a
CI/CD Pipeline / Check if frontend-only change (push) Has been skipped
CI/CD Pipeline / Build Production API Image (push) Has been skipped
CI/CD Pipeline / Build Production Web Image (push) Has been skipped
CI/CD Pipeline / Build Production Worker Image (push) Has been skipped
CI/CD Pipeline / Deploy Production (push) Has been skipped
CI/CD Pipeline / Production Browser E2E (push) Has been skipped
CI/CD Pipeline / Build Staging Web Image (push) Successful in 3m12s
CI/CD Pipeline / Validate Code Quality And Tests (push) Successful in 5m56s
CI/CD Pipeline / Frontend Unit Tests (push) Successful in 5m58s
CI/CD Pipeline / Frontend Lint (push) Successful in 6m32s
CI/CD Pipeline / Unit Tests (push) Failing after 6m48s
CI/CD Pipeline / Build Staging API Image (push) Successful in 8m5s
CI/CD Pipeline / Integration Tests (push) Successful in 2m9s
CI/CD Pipeline / Build Staging Worker Image (push) Successful in 9m50s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Successful in 2m1s
CI/CD Pipeline / ACR Image Cleanup (push) Successful in 41s
CI/CD Pipeline / Staging E2E Tests (push) Failing after 1m34s
CI/CD Pipeline / Staging API Integration Tests (push) Successful in 3m40s
Co-authored-by: xiaoxia <dev@xiaoxiajianji.com> Co-committed-by: xiaoxia <dev@xiaoxiajianji.com>
54 lines
1.5 KiB
Python
Executable File
54 lines
1.5 KiB
Python
Executable File
"""EditTemplateVersion — 模板发布版本快照,用于回滚和版本历史."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass, field
|
|
from datetime import datetime, timezone
|
|
from typing import Any
|
|
from uuid import uuid4
|
|
|
|
|
|
@dataclass(slots=True)
|
|
class EditTemplateVersion:
|
|
"""模板发布版本快照
|
|
|
|
每次发布时保存模板当时的完整状态(config + clip_configs),
|
|
支持回滚到任意历史版本。
|
|
"""
|
|
|
|
id: str
|
|
template_id: str
|
|
version: int
|
|
name: str = ""
|
|
editing_mode: str = "one_take"
|
|
config: dict[str, Any] = field(default_factory=dict)
|
|
clip_configs: list[dict[str, Any]] = field(default_factory=list)
|
|
change_note: str = ""
|
|
published_by: str = ""
|
|
created_at: datetime = field(default_factory=lambda: datetime.now(timezone.utc))
|
|
|
|
@classmethod
|
|
def create(
|
|
cls,
|
|
template_id: str,
|
|
version: int,
|
|
*,
|
|
name: str = "",
|
|
editing_mode: str = "one_take",
|
|
config: dict[str, Any] | None = None,
|
|
clip_configs: list[dict[str, Any]] | None = None,
|
|
change_note: str = "",
|
|
published_by: str = "",
|
|
) -> "EditTemplateVersion":
|
|
return cls(
|
|
id=uuid4().hex,
|
|
template_id=template_id,
|
|
version=version,
|
|
name=name,
|
|
editing_mode=editing_mode,
|
|
config=config or {},
|
|
clip_configs=clip_configs or [],
|
|
change_note=change_note,
|
|
published_by=published_by,
|
|
)
|