Table reservation page - #14
SirQuackyy wants to merge 11 commits into
Conversation
… random assignment, table view, events, and table selection for teams
|
Plz pull from main |
pradhamk
left a comment
There was a problem hiding this comment.
It's probably best to defer merging this into main until the user management dashboard is setup, so we have a good sense of the schema for user teams. Afterwards, we can wire those schemas into the reservation system and merge it.
merge main into branch
There was a problem hiding this comment.
Pull request overview
Adds a full table-reservation feature set spanning participant /reserve, organizer reservation management UI, and a supporting Supabase schema + RLS/audit layer, with Vitest coverage added to validate domain logic, UI behavior, and schema upgrades.
Changes:
- Introduces reservation domain/validation utilities, participant reservation actions, and organizer event/table/assignment/audit workflows.
- Adds Supabase migrations/seeds for teams, events, tables, audit log, constraints/indexes/RLS, plus upgrade fixtures and integration schema tests.
- Adds Vitest + Testing Library setup and a broad test suite for the new reservation functionality.
Reviewed changes
Copilot reviewed 67 out of 68 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| vitest.setup.ts | Adds Testing Library jest-dom matchers for Vitest. |
| vitest.config.ts | Configures Vitest (aliases, setup file, defaults). |
| package.json | Adds Vitest scripts and test/dev dependencies. |
| supabase/config.toml | Registers the new reservation seed in local seed paths. |
| supabase/seeds/reservation-demo.sql | Seeds deterministic teams and assigns demo users to teams. |
| supabase/migrations/20260614183803_applicant_user_fk.sql | Converts an old migration into a compatibility no-op to stabilize ordering. |
| supabase/migrations/20260614183803_snapshot.json | Adds/updates a stored schema snapshot for migration metadata. |
| supabase/migrations/20260628000000_sync_application_schema.sql | Compatibility no-op for an outdated schema sync migration. |
| supabase/migrations/20260629000000_table_reservations.sql | Introduces baseline events/tables schema for reservations. |
| supabase/migrations/20260825000000_reservation_management.sql | Expands reservation schema (teams, lifecycle, audit, constraints, indexes, RLS) and upgrade logic. |
| scripts/reservation-upgrade-fixture.mjs | Inserts legacy reservation fixtures to validate upgrade preservation behavior. |
| scripts/reservation-schema.integration.test.ts | Integration tests asserting schema objects, RLS behavior, and upgrade invariants. |
| lib/reservation/domain.ts | Reservation lifecycle availability + table-count planning logic. |
| lib/reservation/domain.test.ts | Tests for availability logic and table count planning behavior. |
| lib/reservation/layout.ts | Utility to chunk table list into UI rows. |
| lib/reservation/validation.ts | Zod schemas for IDs, table numbers/counts, and event input validation. |
| lib/reservation/validation.test.ts | Tests for reservation validation constraints. |
| lib/reservation/types.ts | Shared types for participant/admin reservation views. |
| lib/reservation/access.ts | Authorization helpers to restrict reservation access to accepted applicants (with locking). |
| lib/reservation/access.test.ts | Tests for accepted-decision predicates. |
| lib/reservation/audit.ts | Helper to write reservation audit entries via a provided executor. |
| lib/db/schema/reservation-teams.ts | Drizzle schema for teams with RLS select policy. |
| lib/db/schema/reservation.ts | Drizzle schema for events/tables/audit log with constraints/indexes and RLS policies. |
| lib/db/schema/users.ts | Adds team_id FK + index to users schema. |
| lib/db/index.ts | Registers reservation schema with the Drizzle database instance. |
| lib/db/queries/reservation.ts | Participant-side reservation queries (events, user, tables). |
| lib/queries/admin-reservations.ts | Organizer-side queries for event lists/details, tables/assignments views, and audit pagination. |
| lib/actions/reservation.ts | Participant server actions for direct and random table reservation with auditing and locking. |
| lib/admin/sections.ts | Adds organizer navigation entry for Reservations (and groups as “Event logistics”). |
| components/ui/dialog.tsx | Adds Dialog UI primitive wrapper (Radix-based) for organizer flows. |
| components/ui/card.tsx | Adjusts card spacing/title styling to support updated UI patterns. |
| components/reservation/event-picker.tsx | Participant event picker control for /reserve. |
| components/reservation/judging-map.tsx | Table-map UI component with participant/admin modes and accessible labels. |
| components/reservation/judging-map.test.tsx | Tests for map interactivity and labeling in participant/admin modes. |
| components/reservation/reservation-board.tsx | Participant reservation UI, integrates map + actions + state messaging. |
| components/reservation/reservation-board.test.tsx | Tests for participant reservation UI behavior and read-only preview mode. |
| app/reserve/page.tsx | Participant /reserve route with organizer redirect + accepted-applicant gating. |
| app/reserve/page.test.tsx | Tests for /reserve authorization/redirect behavior. |
| app/admin/reservations/page.tsx | Organizer Reservations landing page with event list + audit link. |
| app/admin/reservations/reservation-event-list.tsx | Organizer event list UI with lifecycle/window summaries and create dialog. |
| app/admin/reservations/reservation-event-form.tsx | Shared create/edit event form with hydration-safe datetime-local behavior. |
| app/admin/reservations/reservation-event-list.test.tsx | Tests covering organizer reservation event list/layout/nav/form flows. |
| app/admin/reservations/audit/page.tsx | Global reservation audit page with canonical page normalization. |
| app/admin/reservations/audit/audit-pagination.ts | Utilities for parsing/normalizing audit pagination query params. |
| app/admin/reservations/audit/audit-pages.test.tsx | Tests for pagination normalization for global + event audit pages. |
| app/admin/reservations/audit/audit-list.tsx | Audit list UI with expandable JSON details and pagination integration. |
| app/admin/reservations/audit/audit-list.test.tsx | Tests for audit list rendering, details expansion, and page navigation URL updates. |
| app/admin/reservations/[eventId]/layout.tsx | Organizer event workspace layout (status badge, participant preview link, nav). |
| app/admin/reservations/[eventId]/page.tsx | Organizer event overview route. |
| app/admin/reservations/[eventId]/event-overview.tsx | Organizer event overview UI (edit, archive/restore/delete lifecycle). |
| app/admin/reservations/[eventId]/reservation-event-nav.tsx | Workspace navigation tabs for overview/tables/assignments/audit. |
| app/admin/reservations/[eventId]/preview/page.tsx | Organizer-only read-only participant preview for an event. |
| app/admin/reservations/[eventId]/preview/page.test.tsx | Tests for preview behavior and notFound handling. |
| app/admin/reservations/[eventId]/audit/page.tsx | Per-event audit page with canonical page normalization. |
| app/admin/reservations/[eventId]/tables/page.tsx | Organizer tables management route loader. |
| app/admin/reservations/[eventId]/tables/table-management.tsx | Organizer UI for bulk count changes, table creation, renumbering, and safe deletion. |
| app/admin/reservations/[eventId]/tables/table-management.test.tsx | Tests for table-management behaviors and server wiring. |
| app/admin/reservations/[eventId]/assignments/page.tsx | Organizer assignments management route loader. |
| app/admin/reservations/[eventId]/assignments/assignment-management.tsx | Organizer assignment map UI supporting move/swap/displace/unassign. |
| app/admin/reservations/[eventId]/assignments/assignment-management.test.tsx | Tests for organizer assignment interactions, confirmations, and pending/archived behavior. |
| docs/superpowers/specs/2026-07-12-how-to-mcp-page-design.md | Removes obsolete MCP docs design spec. |
| docs/superpowers/plans/2026-07-12-how-to-mcp-page.md | Removes obsolete MCP docs implementation plan. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Summary
Adds a table reservation system for accepted participants and organizers.
Participants
/reservefor direct or random table selection.Organizers
Database and security
Reliability
Test plan
pnpm db:resetpnpm test— 101 tests passedpnpm test:db— 220 tests passedpnpm exec tsc --noEmitpnpm build