feat(staff): super user grant/revoke UI + last-super-user guardrail (GRO-206) #175

Closed
the-dogfather-cto[bot] wants to merge 9 commits from fix/gro-206-superuser-revoke-bug into main
3 changed files with 4 additions and 5 deletions
Showing only changes of commit 7fdb32f95b - Show all commits
+1 -1
View File
@@ -212,7 +212,7 @@ jobs:
- name: Deploy to groombook-dev
env:
TAG: pr-${{ github.event.pull_request.number }}-${{ github.sha::7 }}
TAG: ${{ steps.version.outputs.tag }}
PR_NUM: ${{ github.event.pull_request.number }}
run: |
echo "Deploying images tagged $TAG to groombook-dev..."
-1
View File
@@ -215,4 +215,3 @@ All PRs require CI to pass before merge. See [CONTRIBUTING.md](./CONTRIBUTING.md
## License
AGPL-3.0
# GRO-206 CI trigger
+3 -3
View File
@@ -65,7 +65,7 @@ staffRouter.patch("/:id", zValidator("json", updateStaffSchema), async (c) => {
const superUserCount = await db
.select({ id: staff.id })
.from(staff)
.where(eq(staff.isSuperUser, true))
.where(and(eq(staff.isSuperUser, true), eq(staff.active, true)))
.limit(2); // just need count; fetch 2 to know if > 1
if (superUserCount.length <= 1) {
return c.json(
@@ -86,7 +86,7 @@ staffRouter.patch("/:id", zValidator("json", updateStaffSchema), async (c) => {
const superUserCount = await db
.select({ id: staff.id })
.from(staff)
.where(eq(staff.isSuperUser, true))
.where(and(eq(staff.isSuperUser, true), eq(staff.active, true)))
.limit(2);
if (superUserCount.length <= 1) {
return c.json(
@@ -142,7 +142,7 @@ staffRouter.delete("/:id", async (c) => {
const superUserCount = await db
.select({ id: staff.id })
.from(staff)
.where(eq(staff.isSuperUser, true))
.where(and(eq(staff.isSuperUser, true), eq(staff.active, true)))
.limit(2);
if (superUserCount.length <= 1) {
return c.json(