Add admin role-based event management and Hamneshini explore/reservation flows#1
Open
Aguthcoder wants to merge 1 commit intomainfrom
Open
Add admin role-based event management and Hamneshini explore/reservation flows#1Aguthcoder wants to merge 1 commit intomainfrom
Aguthcoder wants to merge 1 commit intomainfrom
Conversation
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.
Motivation
Description
UserEntity,AuthServiceandAuthController, introducedsrc/modules/common/roles.ts,roles.decorator.ts, androles.guard.tsfor role metadata and enforcement, and improvedJwtAuthGuardto accept bearer or cookie access tokens. (Changed:backend/src/database/entities/user.entity.ts,backend/src/modules/auth/auth.service.ts,backend/src/modules/auth/auth.controller.ts,backend/src/modules/common/jwt-auth.guard.ts; Added:backend/src/modules/common/roles.ts,backend/src/modules/common/roles.decorator.ts,backend/src/modules/common/roles.guard.ts.)admin-eventsmodule and expanded events/reservation flows: richerCreateEventDto/UpdateEventDto, public filtered & paginatedGET /api/events,GET /api/events/:id, and authenticatedPOST /api/events/reserveusing a DB transaction + pessimistic row lock to prevent overbooking and enforce one-reservation-per-user; reused existingEventEntity/EventReservationEntity. (Added:backend/src/modules/admin-events/*,backend/src/modules/events/dto/create-reservation.dto.ts,backend/src/modules/events/dto/update-event.dto.ts; Changed:backend/src/modules/events/events.module.ts,backend/src/modules/events/events.controller.ts,backend/src/modules/events/events.service.ts,backend/src/modules/events/dto/create-event.dto.ts.)/auth/me,/eventsfilters,/events/:id,/admin/events); adjusted login flow to redirect admins to/admin/dashboard; added admin pages and UX (multi-stepadmin/events/newwith live preview), public/explorelist with filters and/events/[id]reservation page with capacity progress and reserve CTA; added middleware to block non-admin users from/admin/*. (Changed:frontend/src/lib/api.ts,frontend/src/app/(auth)/login/page.tsx,frontend/src/app/events/page.tsx,frontend/src/middleware.ts; Added:frontend/src/app/admin/dashboard/page.tsx,frontend/src/app/admin/events/new/page.tsx,frontend/src/app/explore/page.tsx,frontend/src/app/events/[id]/page.tsx.)reservedCountupdates and prevents double-reservation; frontend changes wire new endpoints into existing UI patterns and enforce admin-only client navigation.Testing
cd backend && npm run build, which exercised the new code paths but overall build failed due to pre-existing TypeScript errors in legacy modules (unrelated to the PR) so new backend changes were compiled to the extent possible but global build is blocked by existing repo issues. (result: failed)cd frontend && npm run lint, which reported existing unrelated lint errors in demo/test pages; new pages were adjusted to avoid introducing new lint failures but the project still reports pre-existing errors. (result: failed)cd frontend && npm run devand attempted a Playwright screenshot of/explore, but the dev server surfaced a pre-existing dynamic-route conflict and the capture failed; server reached startup and validated the new routes before the conflict prevented completion. (result: partial/startup reached, screenshot failed)POST /api/auth/loginto receiveaccessToken+user.role, callPOST /api/admin/eventsas an admin to create an event, verify it appears inGET /api/eventsand thatPOST /api/events/reserveenforces capacity and one-reservation-per-user rules.Codex Task