feat(portal): replace mock data with real session-driven API calls #152

Merged
groombook-engineer[bot] merged 25 commits from feat/gro-203-rbac-super-user into main 2026-03-29 07:08:35 +00:00
Showing only changes of commit 1e417eccb1 - Show all commits
+3 -1
View File
@@ -38,11 +38,13 @@ setupRouter.post("/", zValidator("json", setupSchema), async (c) => {
.from(businessSettings)
.limit(1);
// Check if any super user already exists (race condition guard)
// Lock super user rows to prevent concurrent claims
// FOR UPDATE serializes concurrent claims: second transaction blocks until first commits
const [existingSuperUser] = await tx
.select({ id: staff.id })
.from(staff)
.where(eq(staff.isSuperUser, true))
.for("update")
.limit(1);
if (existingSuperUser) {