fix(GRO-1272): auto-provision staff record on first OIDC login #19

Merged
groombook-engineer[bot] merged 4 commits from fleaflicker/gro-1272-auto-provision-staff-dev into dev 2026-05-21 14:16:42 +00:00
2 changed files with 14 additions and 7 deletions
Showing only changes of commit f9b68eb932 - Show all commits
+11 -7
View File
@@ -65,13 +65,17 @@ vi.mock("../db", () => {
Review

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.
Review

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.
const user = makeTableProxy("user");
const buildQuery = (result: unknown, fallback: unknown) => ({
limit: () => ({
Review

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.
[Symbol.iterator]: function* () {
Review

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.
if (result) yield result;
Review

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.
},
Review

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.
0: result,
Review

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.
length: result ? 1 : 0,
Review

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.
}),
Review

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.
[Symbol.iterator]: function* () {
Review

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.
if (result) yield result;
Review

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.
},
Review

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.
limit: (_n: number) => {
Review

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.
const item = result ?? fallback;
Review

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.
return {
Review

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.
[Symbol.iterator]: function* () { if (item) yield item; },
Review

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.
0: item,
Review

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.
length: item ? 1 : 0,
Review

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.
};
Review

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.
},
Review

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.
});
return {
Review

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.
Review

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.

returns with no . All non-limit WHERE queries throw TypeError → 500. Add to the returned object, and make fall back to when is null.
+3
View File
@@ -130,6 +130,9 @@ export const resolveStaffMiddleware: MiddlewareHandler<AppEnv> = async (
Review

TS2769: is — add a guard before to avoid passing .

TS2769: is — add a guard before to avoid passing .
Review

TS2769: is — add a guard before to avoid passing .

TS2769: is — add a guard before to avoid passing .
active: true,
})
.returning();
if (!newStaff) {
Review

TS2769: is — add a guard before to avoid passing .

TS2769: is — add a guard before to avoid passing .
return c.json({ error: "Internal error: staff record creation failed" }, 500);
Review

TS2769: is — add a guard before to avoid passing .

TS2769: is — add a guard before to avoid passing .
}
Review

TS2769: is — add a guard before to avoid passing .

TS2769: is — add a guard before to avoid passing .
c.set("staff", newStaff);
await next();
return;
Review

TS2769: is — add a guard before to avoid passing .

TS2769: is — add a guard before to avoid passing .
Review

TS2769: is — add a guard before to avoid passing .

TS2769: is — add a guard before to avoid passing .