Skip to content

Commit b68186c

Browse files
authored
Re-add missing functions from workspace CRUD (#638)
#633 accidentally deleted some functions that were introduced by #620 This re-introduces them. Signed-off-by: Juan Antonio Osorio <[email protected]>
1 parent 801fcc3 commit b68186c

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/codegate/workspaces/crud.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import datetime
2-
from typing import Optional, Tuple
2+
from typing import Optional, Tuple, List
33

44
from codegate.db.connection import DbReader, DbRecorder
5-
from codegate.db.models import Session, Workspace
5+
from codegate.db.models import Session, Workspace, WorkspaceActive, ActiveWorkspace
66

77

88
class WorkspaceCrud:
@@ -21,12 +21,18 @@ async def add_workspace(self, new_workspace_name: str) -> bool:
2121
workspace_created = await db_recorder.add_workspace(new_workspace_name)
2222
return bool(workspace_created)
2323

24-
async def get_workspaces(self):
24+
async def get_workspaces(self)-> List[WorkspaceActive]:
2525
"""
2626
Get all workspaces
2727
"""
2828
return await self._db_reader.get_workspaces()
2929

30+
async def get_active_workspace(self) -> Optional[ActiveWorkspace]:
31+
"""
32+
Get the active workspace
33+
"""
34+
return await self._db_reader.get_active_workspace()
35+
3036
async def _is_workspace_active_or_not_exist(
3137
self, workspace_name: str
3238
) -> Tuple[bool, Optional[Session], Optional[Workspace]]:

0 commit comments

Comments
 (0)