feat(broker): add project management routes - #30
Merged
Conversation
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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #13
Summary
GET/POST /projects,GET/PATCH/DELETE /projects/:id,GET/POST /projects/:id/members,DELETE /projects/:id/members/:login) all protected byrequireInternalSecret+requireUserLogingetProjectRolehelper inmiddleware.gothat fetches the user's role via a singleListMembersRPC call, enabling both membership and ownership checks without extra round-tripsdenyProjectAccesshelper that distinguishes 404 (project not found) from 403 (forbidden) by probingGetProjectwhen a user has no accessCreateProjectautomatically adds the requesting user as owner viaAddMemberRemoveProjectMemberdetects the last-owner error from the RPC layer and returns 400Test plan
go build ./cmd/api/...— clean compilego test ./cmd/api/... -v— all existing tests pass🤖 Generated with Claude Code