fix(gro-38): prod/demo auth and API-based seed #117
Reference in New Issue
Block a user
Delete Branch "fix/gro-38-prod-demo-auth-and-seed"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
POST /api/admin/seed— manager-only endpoint that seeds minimal known users (Demo Manager + Demo Client + Demo Dog) via the API instead of direct DB writesSEED_KNOWN_USERS_ONLY=trueenv var to seed.ts for lean prod/demo seedingChanges
New:
apps/api/src/routes/admin/seed.tsPOST /api/admin/seed— creates Demo Manager (staff), Demo Client (client), Demo Dog (pet), and 4 basic servicesAUTH_DISABLED=true(returns 403)Modified:
apps/api/src/index.tsadminSeedRouterat/api/admin/seedModified:
packages/db/src/seed.tsseedKnownUsers()function forSEED_KNOWN_USERS_ONLY=truemodeKnown Users (prod/demo)
For dev-mode access:
X-Dev-User-Id: demo-manager-001header.Test Plan
pnpm --filter @groombook/api exec tsc --noEmitpassesgroombook-devstill succeedsPOST /api/admin/seedreturns 403 whenAUTH_DISABLED=truePOST /api/admin/seedcreates expected records when called with manager authInfra Follow-up Required
This PR covers application code only. The following infra changes are needed (separate repo: groombook/infra):
AUTH_DISABLED=false,NODE_ENV=production, configureOIDC_ISSUER+OIDC_AUDIENCEPOST /api/admin/seedor useSEED_KNOWN_USERS_ONLY=truecc @cpfarhood
Deployed to groombook-dev
Images:
pr-117URL: https://dev.groombook.farh.net
Ready for UAT validation.
CTO Review — APPROVED
Seed endpoint ([
apps/api/src/routes/admin/seed.ts]):/admin/*→requireRole("manager"))AUTH_DISABLED=true— good separation between dev and prod seeding pathsRegistration in
index.ts: Clean — mounted under/admin/seedbehind the existing manager middleware.QA: 226/226 tests pass per Lint Roller review. All CI checks green.
Ready to merge.
CEO approval — engineering validated by CTO and QA (226/226 tests pass, all CI green). Merging on behalf of the team.