Skip to content

feat(broker): add project management routes - #30

Merged
jpricardo merged 4 commits into
feat/multi-tenancyfrom
feat/project-management-routes
Apr 20, 2026
Merged

feat(broker): add project management routes#30
jpricardo merged 4 commits into
feat/multi-tenancyfrom
feat/project-management-routes

Conversation

@jpricardo

Copy link
Copy Markdown
Owner

Closes #13

Summary

  • Adds 8 internal routes (GET/POST /projects, GET/PATCH/DELETE /projects/:id, GET/POST /projects/:id/members, DELETE /projects/:id/members/:login) all protected by requireInternalSecret + requireUserLogin
  • Adds getProjectRole helper in middleware.go that fetches the user's role via a single ListMembers RPC call, enabling both membership and ownership checks without extra round-trips
  • Adds denyProjectAccess helper that distinguishes 404 (project not found) from 403 (forbidden) by probing GetProject when a user has no access
  • CreateProject automatically adds the requesting user as owner via AddMember
  • RemoveProjectMember detects the last-owner error from the RPC layer and returns 400

Test plan

  • go build ./cmd/api/... — clean compile
  • go test ./cmd/api/... -v — all existing tests pass
  • Integration tests against the full stack (requires Docker)

🤖 Generated with Claude Code

Implements all eight project CRUD and member management endpoints
(GET/POST /projects, GET/PATCH/DELETE /projects/:id,
GET/POST /projects/:id/members, DELETE /projects/:id/members/:login)
as internal routes protected by X-Internal-Secret + X-User-Login.
Authorization enforces member vs. owner access; last-owner removal
is rejected with 400.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel

vercel Bot commented Apr 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
logwolf-docs Ready Ready Preview, Comment Apr 20, 2026 11:27pm

- CreateProject: rollback project on AddMember failure to prevent
  orphaned projects with no owner
- ListProjectMembers: use getProjectRole + denyProjectAccess so a
  non-existent project ID returns 404 instead of 403

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- denyProjectAccess: distinguish true 404 (no documents) from 500
  (infrastructure error) instead of treating all GetProject failures
  as not-found
- ListProjectMembers: reuse the single ListMembers result for both the
  access check and the response, eliminating the double RPC call
- CreateProject rollback: use idiomatic '_ = client.Call(...)' instead
  of a nolint directive
- RemoveProjectMember: document why string matching is used to detect
  ErrLastOwner (net/rpc strips error types across the wire)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jpricardo
jpricardo merged commit bb177ca into feat/multi-tenancy Apr 20, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant