Skip to content

feat(admin): pass organization deletion through to the auth API - #157

Merged
Bccorb merged 1 commit into
mainfrom
feat/admin-organization-delete-passthrough
Sep 8, 2026
Merged

feat(admin): pass organization deletion through to the auth API#157
Bccorb merged 1 commit into
mainfrom
feat/admin-organization-delete-passthrough

Conversation

@Bccorb

@Bccorb Bccorb commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Follow-up to fells-code/seamless-auth-api#288, which added DELETE /admin/organizations/{organizationId} and limit/offset/search on GET /admin/organizations. Unblocks fells-code/seamless-auth-admin-dashboard#219.

What changed

Neither adapter forwarded the new delete route, so a dashboard or backend calling through the adapter got a 404 from the adapter's own router rather than reaching the API at all. Both now proxy it with the access identity, the same way the neighbouring organization routes are proxied. It is one route entry per adapter:

  • packages/express/src/createServer.ts, an r.delete matching the PATCH above it
  • packages/fastify/src/routes/proxyRoutes.ts, one PROXY_ROUTES entry

What did not need changing

Query forwarding. Both adapters already pass req.query to proxyRequest, so limit, offset and search reach the API with no code change. Nothing in the suite covered that on this route, though, so it would have broken silently. There is now a test pinning it.

Cookie requirements. The requirement map in ensureCookies is prefix matched, so the existing /admin/organizations entry already covers the id-scoped path and the delete requires an access cookie like its neighbours. A test covers the sessionless case, since forwarding a destructive call upstream with no identity attached is the failure that would matter.

Release ordering

No lockstep requirement, unlike the passkey enrollment change. These adapters can ship before or after the API: called against an API that does not serve the route, the delete returns that API's 404, which is what the caller would have got anyway.

Verification

  • pnpm build clean across all three packages
  • pnpm test: core 246, express 159 (up from 156), fastify 54 (up from 52), all passing
  • The two new parity cases were checked by removing the Fastify route and confirming both fail, so they hold the two adapters together rather than passing regardless

Remaining work for the dashboard issue

  • seamless-auth-docs: the new route in the reference table, and the list's query parameters
  • seamless-auth-admin-dashboard: the delete hook, the Remove action, and server-side paging

The auth API gained DELETE /admin/organizations/:organizationId, and neither
adapter forwarded it, so a caller going through the adapter got a 404 from the
adapter's own router rather than reaching the API at all. Both adapters now
proxy it with the access identity, the same way the neighbouring organization
routes are proxied.

GET /admin/organizations needed no change. Both adapters already forward the
query string, so the limit, offset and search parameters the API added alongside
the delete route reach it without one. A test now pins that, since nothing else
in the suite covered query forwarding on this route and it would have broken
silently.

The route requirement in ensureCookies is prefix matched, so /admin/organizations
already covers the id-scoped path and the delete requires an access cookie like
its neighbours. A test covers the sessionless case, because forwarding a
destructive call upstream with no identity attached is the failure that matters.

The parity cases were checked by removing the Fastify route and confirming both
fail, so they hold the two adapters together rather than passing regardless.
@Bccorb
Bccorb merged commit ef5989f into main Sep 8, 2026
2 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