4fee87c5e8
CI/CD Pipeline / Deploy Staging (push) Has been skipped
CI/CD Pipeline / Staging E2E Tests (push) Has been skipped
CI/CD Pipeline / Build Production Runtime Images (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 / Frontend Lint (push) Failing after 45h56m35s
CI/CD Pipeline / Validate Code Quality And Tests (push) Failing after 45h56m48s
任务1: 素材重复上传检测 - 上传接口支持 file_hash 参数,通过 MD5+素材库ID 去重 - 命中去重直接返回已有 asset_id,不重复存 OSS - file_hash 透传: API → IngestJob → Asset 全链路 - 三条上传路径(表单/直传/分片)均支持去重 - Alembic 031: assets + ingest_jobs 加 file_hash 列+索引 - 6 个单元测试覆盖去重命中/未命中/空hash/透传 任务3: 批量生成视频 - POST /generations 支持 count 参数,一次创建多条生成任务 - 每条任务独立状态跟踪,响应返回 task_ids 列表 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
105 lines
2.4 KiB
Python
105 lines
2.4 KiB
Python
"""素材仓储接口定义。"""
|
|
|
|
from abc import ABC, abstractmethod
|
|
|
|
from packages.domain import Asset
|
|
|
|
|
|
class AssetRepository(ABC):
|
|
@abstractmethod
|
|
def create(self, asset: Asset) -> Asset:
|
|
pass
|
|
|
|
@abstractmethod
|
|
def find_by_id(self, asset_id: str) -> Asset | None:
|
|
pass
|
|
|
|
@abstractmethod
|
|
def find_by_project(
|
|
self,
|
|
project_id: str,
|
|
skip: int = 0,
|
|
limit: int = 100,
|
|
) -> list[Asset]:
|
|
pass
|
|
|
|
@abstractmethod
|
|
def find_by_library(
|
|
self,
|
|
library_id: str,
|
|
skip: int = 0,
|
|
limit: int = 100,
|
|
) -> list[Asset]:
|
|
pass
|
|
|
|
@abstractmethod
|
|
def find_by_library_and_file_type(
|
|
self,
|
|
library_id: str,
|
|
file_type: str,
|
|
skip: int = 0,
|
|
limit: int = 100,
|
|
) -> list[Asset]:
|
|
pass
|
|
|
|
@abstractmethod
|
|
def update(self, asset: Asset) -> Asset:
|
|
pass
|
|
|
|
@abstractmethod
|
|
def delete(self, asset_id: str) -> bool:
|
|
pass
|
|
|
|
@abstractmethod
|
|
def batch_delete(self, asset_ids: list[str]) -> int:
|
|
"""批量删除素材,返回实际删除数量。"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def count_by_project(self, project_id: str) -> int:
|
|
pass
|
|
|
|
@abstractmethod
|
|
def count_by_project_ids(self, project_ids: list[str]) -> int:
|
|
pass
|
|
|
|
@abstractmethod
|
|
def sum_storage_by_project_ids(self, project_ids: list[str]) -> int:
|
|
pass
|
|
|
|
@abstractmethod
|
|
def search_candidates(
|
|
self,
|
|
project_id: str,
|
|
*,
|
|
file_type: str | None = None,
|
|
min_quality_score: float | None = None,
|
|
min_duration: float | None = None,
|
|
max_duration: float | None = None,
|
|
classification_category: str | None = None,
|
|
tags: list[str] | None = None,
|
|
status: str | None = None,
|
|
limit: int = 50,
|
|
) -> list[Asset]:
|
|
"""按筛选条件搜索候选素材,按质量分降序排列。"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def find_by_tag_ids(
|
|
self,
|
|
tag_ids: list[str],
|
|
skip: int = 0,
|
|
limit: int = 100,
|
|
) -> list[Asset]:
|
|
"""查找包含所有指定标签的素材。"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def find_by_library_and_file_hash(
|
|
self,
|
|
library_id: str,
|
|
file_hash: str,
|
|
) -> Asset | None:
|
|
"""按素材库 + 文件哈希查找已有素材(去重检测)。"""
|
|
pass
|