fix: skip booking time restrictions for admin/owner users#2223
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Added `isAdminOrOwner` parameter to `BookingFormSchema` and `ExtendBookingSchema` that bypasses bufferStartTime and maxBookingLength validations for ADMIN/OWNER users while still enforcing them for BASE/SELF_SERVICE users. Updated all client-side components and server-side routes to pass the user role information to the schemas. Co-authored-by: DonKoko <7840007+DonKoko@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix booking time restrictions for OWNER and ADMIN users
fix: skip booking time restrictions for admin/owner users
Dec 1, 2025
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
DonKoko
approved these changes
Dec 2, 2025
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.
Booking time restrictions (
bufferStartTime,maxBookingLength) were being enforced for all user roles. These settings should only restrict BASE and SELF_SERVICE users—ADMIN and OWNER users should be exempt.Changes
Schema updates (
forms-schema.ts): AddedisAdminOrOwnerparameter toBookingFormSchemaandExtendBookingSchema. Whentrue, bypasses buffer and max length validations while preserving working hours restrictions.Client-side components: Pass
isAdministratorOrOwnerfromuseUserRoleHelper()hook to schemas in:new-booking-form.tsxedit-booking-form.tsxextend-booking-dialog.tsxcreate-booking-for-selected-assets-dialog.tsxServer-side routes: Derive
isAdminOrOwnerfrom!isSelfServiceOrBasein:bookings.new.tsxbookings.$bookingId.overview.tsxExample
Tests
Added 9 unit tests in
forms-schema.test.tscovering restriction bypass for admin/owner and enforcement for base/self-service users.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
checkpoint.prisma.io/usr/local/bin/node /usr/local/bin/node /home/REDACTED/work/shelf.nu/shelf.nu/node_modules/prisma/build/child {"product":"prisma","version":"6.19.0","cli_install_type":"local","information":"","local_timestamp":"2025-12-01T13:37:29Z","project_hash":"e6fa372b","cli_path":"/home/REDACTED/work/shelf.nu/shelf.nu/node_modules/.bin/prisma","cli_path_hash":"39199cc4","end(dns block)/usr/local/bin/node /usr/local/bin/node /home/REDACTED/work/shelf.nu/shelf.nu/node_modules/prisma/build/child {"product":"prisma","version":"6.19.0","cli_install_type":"local","information":"","local_timestamp":"2025-12-01T13:49:42Z","project_hash":"e6fa372b","cli_path":"/home/REDACTED/work/shelf.nu/shelf.nu/node_modules/.bin/prisma","cli_path_hash":"39199cc4","end(dns block)/usr/local/bin/node /usr/local/bin/node /home/REDACTED/work/shelf.nu/shelf.nu/node_modules/prisma/build/child {"product":"prisma","version":"6.19.0","cli_install_type":"local","information":"","local_timestamp":"2025-12-01T13:51:37Z","project_hash":"e6fa372b","cli_path":"/home/REDACTED/work/shelf.nu/shelf.nu/node_modules/.bin/prisma","cli_path_hash":"39199cc4","end(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.