Skip to content

Commit

Permalink
Re-add missing functions from workspace CRUD (#638)
Browse files Browse the repository at this point in the history
#633 accidentally deleted some
functions that were introduced by #620

This re-introduces them.

Signed-off-by: Juan Antonio Osorio <[email protected]>
  • Loading branch information
JAORMX authored Jan 17, 2025
1 parent 801fcc3 commit b68186c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/codegate/workspaces/crud.py
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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]]:
Expand Down

0 comments on commit b68186c

Please sign in to comment.