Files
xiaoxia-saas/packages/ports/asset_library_repository.py
T
xiaoxia 0422967229 refactor: Remove workspace concept - Projects now directly under User
BREAKING CHANGES:
- Removed Workspace, WorkspaceMember, WorkspaceInvitation entities
- Project now has owner_user_id instead of workspace_id
- Added shared_users list to Project for collaboration
- Subscription/quota moved from Workspace to User level

Changes:
- packages/domain/entities.py: Removed Workspace entities, updated Project
- packages/adapters/sqlalchemy_impl/models.py: Updated models
- packages/application/: Removed workspace use cases, updated other use cases
- packages/ports/: Removed workspace repository interfaces
- apps/api/: Updated routes, schemas, dependencies, router
- alembic/versions/007_remove_workspace_concept.py: Database migration

New APIs:
- POST /projects/{id}/share: Share project with user
- DELETE /projects/{id}/share/{user_id}: Unshare project
2026-06-26 19:16:54 +08:00

39 lines
990 B
Python

"""兼容层:旧素材库仓储接口定义,保留给遗留异步适配器使用。"""
from abc import ABC, abstractmethod
from packages.domain import AssetLibrary, AssetLibraryKind
class AssetLibraryRepository(ABC):
@abstractmethod
async def create(self, library: AssetLibrary) -> AssetLibrary:
pass
@abstractmethod
async def find_by_id(self, library_id: str) -> AssetLibrary | None:
pass
@abstractmethod
async def find_by_project(
self,
project_id: str,
) -> list[AssetLibrary]:
pass
@abstractmethod
async def update(self, library: AssetLibrary) -> AssetLibrary:
pass
@abstractmethod
async def delete(self, library_id: str) -> bool:
pass
@abstractmethod
async def increment_asset_count(self, library_id: str, size_delta: int) -> None:
pass
@abstractmethod
async def decrement_asset_count(self, library_id: str, size_delta: int) -> None:
pass