8d0c4c873f
CI Build & Deploy Pipeline / Build Staging API Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI Build & Deploy Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI Build & Deploy Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI Build & Deploy Pipeline / Build Production API Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Build Production Web Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Build Production Worker Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Deploy Production (pull_request) Has been skipped
CI Build & Deploy Pipeline / Production Browser E2E (pull_request) Has been skipped
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 39s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been skipped
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 46s
CI/CD Pipeline / Frontend Lint (pull_request) Successful in 1m9s
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Failing after 1m44s
Auto Merge CI PRs / Auto Merge on CI Green + Approved (pull_request) Successful in 2m27s
AI Code Review / AI Code Review (pull_request) Successful in 2m40s
CI/CD Pipeline / Unit Tests (pull_request) Failing after 2m48s
CI/CD Pipeline / Integration Tests (pull_request) Failing after 1m12s
Auto Approve CI PRs / Auto Approve on CI Green (pull_request) Successful in 3m42s
- generated_videos表加user_id列及索引 - 写表时透传user_id(edit_plan_generation + one_take生成) - /videos接口默认按当前用户查,不传project_id不再查全表 - project_id降级为可选过滤条件 - 补单元测试覆盖user_id过滤逻辑
72 lines
2.1 KiB
Python
Executable File
72 lines
2.1 KiB
Python
Executable File
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 GeneratedVideo:
|
|
id: str
|
|
project_id: str
|
|
user_id: str
|
|
generation_task_id: str
|
|
name: str
|
|
file_url: str
|
|
file_size: int
|
|
duration: float
|
|
width: int
|
|
height: int
|
|
fps: float
|
|
thumbnail_url: str | None = None
|
|
status: str = "completed"
|
|
review_status: str = "pending_review"
|
|
generation_params: dict[str, Any] = field(default_factory=dict)
|
|
video_fingerprint: dict[str, Any] | None = None
|
|
is_duplicate: bool = False
|
|
duplicate_of: str | None = None
|
|
generated_at: datetime = field(default_factory=lambda: datetime.now(timezone.utc))
|
|
created_at: datetime = field(default_factory=lambda: datetime.now(timezone.utc))
|
|
|
|
@classmethod
|
|
def create(
|
|
cls,
|
|
project_id: str,
|
|
user_id: str,
|
|
generation_task_id: str,
|
|
name: str,
|
|
file_url: str,
|
|
*,
|
|
file_size: int = 0,
|
|
duration: float = 0.0,
|
|
width: int = 0,
|
|
height: int = 0,
|
|
fps: float = 0.0,
|
|
thumbnail_url: str | None = None,
|
|
generation_params: dict[str, Any] | None = None,
|
|
) -> "GeneratedVideo":
|
|
if not project_id.strip():
|
|
raise ValueError("project_id cannot be empty")
|
|
if not generation_task_id.strip():
|
|
raise ValueError("generation_task_id cannot be empty")
|
|
if not name.strip():
|
|
raise ValueError("name cannot be empty")
|
|
if not file_url.strip():
|
|
raise ValueError("file_url cannot be empty")
|
|
return cls(
|
|
id=uuid4().hex,
|
|
project_id=project_id.strip(),
|
|
user_id=user_id.strip(),
|
|
generation_task_id=generation_task_id.strip(),
|
|
name=name.strip(),
|
|
file_url=file_url.strip(),
|
|
file_size=file_size,
|
|
duration=duration,
|
|
width=width,
|
|
height=height,
|
|
fps=fps,
|
|
thumbnail_url=thumbnail_url,
|
|
generation_params=generation_params or {},
|
|
)
|