25 lines
880 B
Python
25 lines
880 B
Python
"""Abstract repository for Workspace and WorkspaceInvitation."""
|
|
|
|
from abc import abstractmethod
|
|
from uuid import UUID
|
|
|
|
from app.entities.workspace import Workspace
|
|
from app.entities.workspace_invitation import WorkspaceInvitation
|
|
from app.repositories.base import Repository
|
|
|
|
|
|
class WorkspaceRepository(Repository[Workspace]):
|
|
pass # CRUD is sufficient; no entity-specific queries needed yet
|
|
|
|
|
|
class WorkspaceInvitationRepository(Repository[WorkspaceInvitation]):
|
|
@abstractmethod
|
|
async def get_by_token_hash(self, token_hash: str) -> WorkspaceInvitation | None:
|
|
"""Look up a pending invitation by the hash of the raw token."""
|
|
|
|
@abstractmethod
|
|
async def list_by_workspace(
|
|
self, workspace_id: UUID, status: str | None = None
|
|
) -> list[WorkspaceInvitation]:
|
|
"""Return invitations for a workspace, optionally filtered by status."""
|