0422967229
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
31 lines
945 B
Python
31 lines
945 B
Python
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass
|
|
from uuid import uuid4
|
|
|
|
from packages.domain import ClassificationJob
|
|
from packages.ports.classification_job_repository import ClassificationJobRepository
|
|
|
|
|
|
@dataclass(slots=True)
|
|
class SubmitClassificationJobCommand:
|
|
project_id: str
|
|
asset_id: str
|
|
|
|
|
|
class SubmitClassificationJobUseCase:
|
|
def __init__(self, classification_job_repository: ClassificationJobRepository):
|
|
self.classification_job_repository = classification_job_repository
|
|
|
|
def execute(self, command: SubmitClassificationJobCommand) -> ClassificationJob:
|
|
job = ClassificationJob(
|
|
id=uuid4().hex,
|
|
project_id=command.project_id,
|
|
asset_id=command.asset_id,
|
|
status="pending",
|
|
classification="",
|
|
confidence=0.0,
|
|
error_message="",
|
|
)
|
|
return self.classification_job_repository.create(job)
|