feat: add multiple admin support for rooms#43
Open
buildingvibes wants to merge 1 commit into
Open
Conversation
- Add OWNER role to distinguish room creators from promoted admins - Update room creation to assign OWNER role to the creator - Update admin check to use RoomUser.role instead of only room.adminId - Add /api/room/[roomId]/admins API for listing members and promoting/demoting - Add /api/room/[roomId]/join API to track room membership via RoomUser - Create AdminPanel component for the room owner to manage member roles - Add "Manage" button in Topbar visible to room owners - Include Prisma migration for OWNER enum value Closes Fahad-Dezloper#27 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@buildingvibes is attempting to deploy a commit to the fahad-dezloper's projects Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resolves #27 — Multiple Admin Support
This PR introduces a full multiple admin system for Crowdify rooms:
OWNERrole (distinct fromADMIN), ensuring they can never be demoted and retain full controlisAdmincheck in/api/room/[roomId]now queriesRoomUser.roleinstead of comparing againstroom.adminId, enabling multiple admins per room/api/room/[roomId]/admins): Room owners can promote any room member toADMINor demote them back toUSER. Owners cannot be modified./api/room/[roomId]/join): When users enter a room, aRoomUserrecord is created (upsert), so all participants are tracked for role managementAdminPanelmodal component (accessible via "Manage" button in the top bar) shows all room members with their roles and allows the owner to promote/demote users with a single clickOWNERvalue to theRoleenum and migrates existing room creators fromADMINtoOWNERChanges
prisma/schema.prismaOWNERtoRoleenumprisma/migrations/20250212000000_multiple_admin_support/app/api/room/create/route.tsOWNERrole instead ofADMINapp/api/room/[roomId]/route.tsRoomUser.role, returnsisOwnerflagapp/api/room/[roomId]/admins/route.tsapp/api/room/[roomId]/join/route.tsapp/context/WebContext.tsxisOwner,roomUsers,promoteToAdmin,demoteFromAdmin; auto-joins roomapp/components/AdminPanel.tsxapp/components/Topbar.tsxTest plan
OWNERroleRoomUserwithUSERrole is createdADMINUSERand verify admin controls are removed🤖 Generated with Claude Code