refactor(auth): simplify authorization checks to use membership only

- Remove explicit ADMIN role checks in API handlers
- Replace combined creator/member role checks with membership-only filters
- Update seed data roles to reflect changed authorization logic
- Add migration to insert hunt creators as members for consistent checks
- Prevent removal of hunt creator as a member with new explicit check
- Adjust related user role updates and queries accordingly
- Upgrade dependencies including nuxt and zod for compatibility
This commit is contained in:
2026-07-30 21:59:36 +02:00
parent a6053855b8
commit cfda014760
18 changed files with 2598 additions and 487 deletions
@@ -0,0 +1,8 @@
-- Add hunt creators as HuntMembers so authorization only needs membership check
INSERT INTO "HuntMember" ("huntId", "memberId", "createdAt")
SELECT h."id", h."creatorId", NOW()
FROM "Hunt" h
WHERE NOT EXISTS (
SELECT 1 FROM "HuntMember" hm
WHERE hm."huntId" = h."id" AND hm."memberId" = h."creatorId"
);