e9d2831850
CI Build & Deploy Pipeline / Build Staging API Image (push) Has been skipped
CI Build & Deploy Pipeline / Build Staging Web Image (push) Has been skipped
CI Build & Deploy Pipeline / Build Staging Worker Image (push) Has been skipped
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) (push) Has been skipped
CI Build & Deploy Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI Build & Deploy Pipeline / Build Production API Image (push) Has been skipped
CI Build & Deploy Pipeline / Build Production Web Image (push) Has been skipped
CI Build & Deploy Pipeline / Build Production Worker Image (push) Has been skipped
CI Build & Deploy Pipeline / Staging E2E Tests (push) Has been skipped
CI Build & Deploy Pipeline / Staging API Integration Tests (push) Has been skipped
CI Build & Deploy Pipeline / Deploy Production (push) 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 / Production Browser E2E (push) Has been skipped
CI/CD Pipeline / Frontend Lint (push) Successful in 1m33s
CI/CD Pipeline / Frontend Lint (pull_request) Successful in 1m30s
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 / Unit Tests (push) Successful in 3m13s
CI/CD Pipeline / Unit Tests (pull_request) Successful in 3m18s
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Failing after 16m16s
CI/CD Pipeline / Validate Code Quality And Tests (push) Failing after 16m20s
CI/CD Pipeline / Integration Tests (push) Successful in 2m30s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 2m24s
37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass
|
|
|
|
from packages.domain import AssetLibrary, AssetLibraryKind
|
|
from packages.ports.asset_library_repository import AssetLibraryRepository
|
|
|
|
|
|
@dataclass(slots=True)
|
|
class CreateAssetLibraryCommand:
|
|
project_id: str
|
|
name: str
|
|
kind: AssetLibraryKind
|
|
|
|
|
|
class ListAssetLibrariesUseCase:
|
|
def __init__(self, asset_library_repository: AssetLibraryRepository):
|
|
self.asset_library_repository = asset_library_repository
|
|
|
|
def execute(self, project_id: str) -> list[AssetLibrary]:
|
|
if not project_id.strip():
|
|
raise ValueError("project_id 不能为空")
|
|
return self.asset_library_repository.find_by_project(project_id.strip()) # type: ignore[return-value]
|
|
|
|
|
|
class CreateAssetLibraryUseCase:
|
|
def __init__(self, asset_library_repository: AssetLibraryRepository):
|
|
self.asset_library_repository = asset_library_repository
|
|
|
|
def execute(self, command: CreateAssetLibraryCommand) -> AssetLibrary:
|
|
library = AssetLibrary.create(
|
|
project_id=command.project_id,
|
|
name=command.name,
|
|
kind=command.kind,
|
|
)
|
|
return self.asset_library_repository.create(library) # type: ignore[return-value]
|