diff --git a/src/codegate/workspaces/crud.py b/src/codegate/workspaces/crud.py index 9902e80b..9d2beef6 100644 --- a/src/codegate/workspaces/crud.py +++ b/src/codegate/workspaces/crud.py @@ -1,8 +1,8 @@ import datetime -from typing import Optional, Tuple +from typing import Optional, Tuple, List from codegate.db.connection import DbReader, DbRecorder -from codegate.db.models import Session, Workspace +from codegate.db.models import Session, Workspace, WorkspaceActive, ActiveWorkspace class WorkspaceCrud: @@ -21,12 +21,18 @@ async def add_workspace(self, new_workspace_name: str) -> bool: workspace_created = await db_recorder.add_workspace(new_workspace_name) return bool(workspace_created) - async def get_workspaces(self): + async def get_workspaces(self)-> List[WorkspaceActive]: """ Get all workspaces """ return await self._db_reader.get_workspaces() + async def get_active_workspace(self) -> Optional[ActiveWorkspace]: + """ + Get the active workspace + """ + return await self._db_reader.get_active_workspace() + async def _is_workspace_active_or_not_exist( self, workspace_name: str ) -> Tuple[bool, Optional[Session], Optional[Workspace]]: