feat(gateway): WorkspaceService + ProjectBootstrapService + TeamsService (P8-015) #183

Merged
jason.woltje merged 1 commits from feat/p8-015-workspaces into main 2026-03-16 03:14:11 +00:00
Owner

Summary

  • WorkspaceService: resolves workspace paths (user/team), git init/clone, directory lifecycle (create/delete/exists), user and team root provisioning; reads MOSAIC_ROOT env var (defaults to /opt/mosaic)
  • ProjectBootstrapService: single call orchestrating Brain project DB record creation + workspace directory init, with optional repoUrl for clone-based bootstrap
  • TeamsService: isMember, canAccessProject, findAll, findById, listMembers via Drizzle queries against teams/teamMembers/projects tables
  • WorkspaceController: POST /api/workspaces — auth-guarded endpoint that calls ProjectBootstrapService.bootstrap()
  • TeamsController: GET /api/teams, /:teamId, /:teamId/members, /:teamId/members/:userId
  • WorkspaceModule wired into AppModule
  • workspace.service.spec.ts: 5 unit tests for resolvePath (user, team, fallback, MOSAIC_ROOT env, default)

Closes #168

Test plan

  • All existing tests still pass (84 tests, 10 files)
  • workspace.service.spec.ts — 5 new tests for path resolution logic
  • Typecheck, lint, format:check all green
## Summary - **WorkspaceService**: resolves workspace paths (user/team), git init/clone, directory lifecycle (create/delete/exists), user and team root provisioning; reads `MOSAIC_ROOT` env var (defaults to `/opt/mosaic`) - **ProjectBootstrapService**: single call orchestrating Brain project DB record creation + workspace directory init, with optional `repoUrl` for clone-based bootstrap - **TeamsService**: `isMember`, `canAccessProject`, `findAll`, `findById`, `listMembers` via Drizzle queries against `teams`/`teamMembers`/`projects` tables - **WorkspaceController**: `POST /api/workspaces` — auth-guarded endpoint that calls `ProjectBootstrapService.bootstrap()` - **TeamsController**: `GET /api/teams`, `/:teamId`, `/:teamId/members`, `/:teamId/members/:userId` - **WorkspaceModule** wired into `AppModule` - `workspace.service.spec.ts`: 5 unit tests for `resolvePath` (user, team, fallback, MOSAIC_ROOT env, default) Closes #168 ## Test plan - All existing tests still pass (84 tests, 10 files) - `workspace.service.spec.ts` — 5 new tests for path resolution logic - Typecheck, lint, format:check all green
jason.woltje added 1 commit 2026-03-16 03:07:06 +00:00
feat(gateway): WorkspaceService + ProjectBootstrapService + TeamsService (P8-015)
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful
0821393c1d
- WorkspaceService: path resolution, git init/clone, directory lifecycle (create/delete/exists), user and team root provisioning
- ProjectBootstrapService: orchestrates DB record creation (via Brain) + workspace directory init in a single call
- TeamsService: isMember, canAccessProject, findAll, findById, listMembers via Drizzle DB queries
- WorkspaceController: POST /api/workspaces — auth-guarded project bootstrap endpoint
- TeamsController: GET /api/teams, /:teamId, /:teamId/members, /:teamId/members/:userId
- WorkspaceModule wired into AppModule
- workspace.service.spec.ts: 5 unit tests for resolvePath (user, team, fallback, env var, default)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
jason.woltje merged commit ff27e944a1 into main 2026-03-16 03:14:11 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mosaicstack/stack#183