Repository navigation
feat(api-keys, webhooks): organization_id on list and create (Scaffald/SaaS#1440) - #44
Merged
Merged
Conversation
…d/SaaS#1440) API keys and webhooks belong to an organization. The per-organization Developers tab passes the organization explicitly, so a member of more than one organization never hits "pass organization_id", and each tab lists only its own organization's keys and webhooks. - apiKeys.list(params?) and webhooks.list(params?) take { organization_id }. - CreateApiKeyParams and CreateWebhookParams accept organization_id. - ApiKey carries organization_id; Webhook carries its delivery statistics. Co-Authored-By: Claude Opus 5.5 <[email protected]>
thinkclay
added a commit
to Scaffald/SaaS
that referenced
this pull request
Nov 25, 2026
…rged Scaffald/sdk#44 Co-Authored-By: Claude Opus 5.5 <[email protected]>
thinkclay
added a commit
to Scaffald/SaaS
that referenced
this pull request
Nov 25, 2026
…evelopers tab (#1440) (#1444) * feat(developers): API keys and webhooks move to each organization's Developers tab (#1440) API keys and webhooks belong to an organization, but they sat in Office, which admits only the platform `office` role, so an employer admin could not manage their own. They now live on the organization, the way #1312 moved Applications to /hiring. App - /employers/org/[slug]/developers with API keys and Webhooks views, and a Developers tab beside Teams and Logs (ROUTES.EMPLOYERS.ORG.DETAIL.DEVELOPERS). The organization comes from the slug and is sent with every call. - DeveloperPortal takes organizationId and canManage. Create, re-scope and revoke are offered only to the organization's admins (owner, org `admin` role, or team_admin on any of its teams); everyone else gets a read-only list. - The webhook list, create and a new detail screen (status, stats, events, recent deliveries, delete) moved to features/developers. The old list row pushed /office/webhooks/:id, which had no route file and was a 404. - /office/api-keys and /office/webhooks/* redirect for every signed-in user: the Office layout skips its role gate for them (isLegacyDevelopersPath), as it does for the hiring paths. One organization goes straight to the same screen on it; several or none go to My Organizations. Office's own links to them are gone. Api - lib/org-developer-roles.ts: one rule for membership and admin, read from teams, ownership and org-scoped roles. api-keys read teams only, so the owner on no team (the seeded orgAdmin) was refused every call; webhooks read org-scoped roles only, so a team_admin without one could not create a webhook. - GET /v1/api-keys takes ?organization_id= and returns organization_id. - Creating a key or a webhook, and deleting a webhook, now need admin, like revoking a key already did. - GET /v1/webhooks/{id} and /{id}/deliveries, which the SDK called and the api never served. List and detail no longer carry the signing secret. SDK pointer: Scaffald/sdk#44 (organization_id on list and create). Tests: tests/routers/org-developers-rest.test.ts (gated) covers the orgAdmin persona, a team_admin of two organizations without the office role, a plain member and an outsider. api-keys-org-authz-rest.test.ts uses a fresh plain member: the seeds give nikola the org-scoped admin role. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(webhooks): declare each route's error responses, so the handlers type-check (#1440) The openapi routes declared only their success response, so every c.json(..., 401/403/404/500) was a type error: three on main, two more from the detail and deliveries routes this PR added. Each route now declares the errors it returns, and the success returns name their 200. webhooks.ts goes from 5 type errors to 0, so its TYPECHECK_BASELINE entry (3) is removed. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
3 tasks done
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.
API keys and webhooks belong to an organization. Scaffald/SaaS#1440 moves them from Office (platform staff only) to a Developers tab on each organization. Every call from that tab names its organization, so a member of more than one never hits the api's "pass organization_id" refusal, and each tab lists only its own organization's rows.
apiKeys.list(params?)andwebhooks.list(params?)take{ organization_id }(newListApiKeysParams,ListWebhooksParams).CreateApiKeyParamsandCreateWebhookParamsacceptorganization_id. The api already accepted it on create.ApiKeycarriesorganization_id.Webhookcarries the delivery statistics columns the table keeps (total_deliveries,last_delivery_at, …).Everything is optional, so existing callers are unchanged. The matching api changes (the
organization_idlist filter, plusGET /v1/webhooks/{id}and/{id}/deliveries, whichretrieveandlistDeliveriesalready called but the api never served) are in the SaaS PR that bumps this pointer.pnpm test(787 passed),pnpm typecheckclean.🤖 Generated with Claude Code