Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-add missing functions from workspace CRUD #638

Merged
merged 1 commit into from
Jan 17, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading