b5a62ee9a3
- domain: User, Workspace, Project, AssetLibrary, Asset, IngestJob - ports: repository interfaces - application: use cases - adapters: in-memory - API: FastAPI 5 routes - worker: Celery ingest_asset - tests: 4 passing
17 lines
477 B
Python
17 lines
477 B
Python
from __future__ import annotations
|
|
|
|
from packages.domain import Project
|
|
|
|
|
|
class InMemoryProjectRepository:
|
|
def __init__(self):
|
|
self._items: dict[str, list[Project]] = {}
|
|
|
|
def list_by_workspace(self, workspace_id: str) -> list[Project]:
|
|
return list(self._items.get(workspace_id, []))
|
|
|
|
def create(self, project: Project) -> Project:
|
|
items = self._items.setdefault(project.workspace_id, [])
|
|
items.append(project)
|
|
return project
|