Files
zpan/migrations
Jasper Van a1510906fb feat: add Better Auth organization + admin plugins (#241)
Enable org-aware architecture: auto-create personal org on signup,
first user promoted to admin (race-safe atomic SQL), requireAdmin
middleware, org context resolution in auth middleware.

- Add organization, member, invitation tables to auth schema
- Add admin plugin fields (role, banned, banReason, banExpires) to user
- Add session fields (impersonatedBy, activeOrganizationId)
- Rename storage_quotas → org_quotas, matters.uid → matters.org_id
- Add findPersonalOrg service with SQL-level metadata filtering
- Widen Database type to include both app and auth schemas
- Include auth schema in Cloudflare platform adapter
- Update shared types for org-aware API (OrgQuota, Organization, Member)
- Add DB migration 0001_org_and_admin_plugins
- Add tests for admin role, org creation, requireAdmin, findPersonalOrg
- Fix pre-existing shared package typecheck (add typescript devDep)

Agent-Profile: https://agent-kanban.dev/agents/a6bb038c4226a87f

Co-authored-by: Bob <aibob@mails.agent-kanban.dev>
2026-04-01 16:20:02 -04:00
..