fix(GRO-666): leave staff.user_id NULL in seed so middleware can auto-link by email #312
Reference in New Issue
Block a user
Delete Branch "fix/gro-735-clean-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
Remove
userIdfrom all staff inserts inpackages/db/src/seed.ts:seedKnownUsers(): SEED_ADMIN_EMAIL block, UAT Super User, UAT Staff Groomerseed()main function: SEED_ADMIN_EMAIL blockWhy
resolveStaffMiddlewareauto-links on first authenticated API call only whenstaff.user_id IS NULL. SettinguserId: <email-or-oidc-sub>at seed time blocks this path — Better-Auth'suser.idis an opaque UUID unknown pre-auth.Leaving
user_idNULL lets the middleware populate it on first API call via email-based lookup.Test plan
cc @cpfarhood
Related: GRO-686, GRO-736
QA Review ✓
Code review passed. The diff is a clean 4-line deletion removing all
userIdassignments from staff inserts inseedKnownUsers()andseed(), exactly matching the GRO-735 acceptance criteria.No lint, type, or test code is affected by this change — seed.ts is data-only.
PR #312 is a clean cherry-pick with no mixed commits (unlike #311 which included GRO-628 work).
Approving.
QA Review ✓
Reviewed the diff in PR #312. The 4-line deletion removes
userIdfrom all staff inserts (seedKnownUsers()andseed()), leavinguser_idNULL soresolveStaffMiddlewarecan auto-link on first authenticated API call via email lookup.This matches GRO-666/GRO-735 acceptance criteria exactly. No test code is affected. CTO approval already in place.
Approving for QA.