Skip to content

Add booking approval/rejection workflow for admin review#2318

Draft
carlosvirreira wants to merge 1 commit into
mainfrom
claude/add-booking-approval-actions-uZJAH
Draft

Add booking approval/rejection workflow for admin review#2318
carlosvirreira wants to merge 1 commit into
mainfrom
claude/add-booking-approval-actions-uZJAH

Conversation

@carlosvirreira
Copy link
Copy Markdown
Contributor

Summary

This PR introduces a new booking approval/rejection workflow that allows administrators and owners to review and approve/reject bookings created by BASE users. When a booking is rejected, the custodian receives a notification with the rejection reason.

Key Changes

Database & Schema

  • Added two new booking statuses: APPROVED and REJECTED
  • Added rejectionReason field to the Booking model to store rejection details
  • Created migration to add these new statuses and field

Booking Service

  • Implemented approveBooking() function to transition RESERVED bookings to APPROVED status
  • Implemented rejectBooking() function to transition RESERVED bookings to REJECTED status with a reason
  • Added email notifications for both approval and rejection
  • Updated cancelBooking() to support cancelling APPROVED bookings
  • Updated revertBookingToDraft() to support reverting from APPROVED status
  • Updated booking conflict detection to treat APPROVED bookings like RESERVED (they block other bookings)

UI Components

  • Created new RejectBookingDialog component with form for entering rejection reason
  • Updated ActionsDropdown to show approve/reject actions only for:
    • Admin/Owner users
    • RESERVED bookings
    • Bookings created by BASE users
  • Updated EditBookingForm to disable editing for REJECTED bookings
  • Updated RevertToDraftDialog to support APPROVED status
  • Updated TimeRemaining component to handle APPROVED status
  • Updated AvailabilityLabel to treat APPROVED bookings as unavailable

Email Templates

  • Extended BookingUpdatesEmailTemplate to support custom reason labels
  • Added approvedBookingEmailContent() for approval notifications
  • Added rejectedBookingEmailContent() for rejection notifications with reason

Permissions & Validation

  • Added validation schema RejectBookingSchema for rejection reason (required, max 500 chars)
  • Restricted approve/reject actions to administrators and owners only
  • Added permission checks in booking overview route

Other Updates

  • Updated booking status helpers to include isApproved and isRejected flags
  • Updated various booking list views to include APPROVED status
  • Updated calendar status styling for APPROVED (green) and REJECTED (red) bookings
  • Updated bulk actions to exclude REJECTED bookings from bulk operations

Implementation Details

  • Approval/rejection is only available for RESERVED bookings created by BASE users
  • When a booking is rejected, any active schedulers are cancelled
  • Both approval and rejection create status transition notes for audit trail
  • Email notifications are sent to the custodian with appropriate messaging
  • The rejection reason is displayed on the booking detail page

https://claude.ai/code/session_01MWiJMghMb6ZB6QVcMy1MUa

…ings

Add APPROVED and REJECTED statuses to the BookingStatus enum with
full approval workflow for Base user booking requests.

Schema changes:
- Add APPROVED and REJECTED values to BookingStatus enum
- Add rejectionReason field to Booking model
- Database migration for new enum values and field

Service layer:
- Add approveBooking() function (RESERVED -> APPROVED)
- Add rejectBooking() function (RESERVED -> REJECTED)
- Update cancelBooking to accept APPROVED bookings
- Update revertBookingToDraft to accept APPROVED bookings
- Update checkoutBooking to work from APPROVED status
- Update booking conflict detection to include APPROVED
- Add status transition notes for approve/reject

Email notifications:
- Add approved booking email content helper
- Add rejected booking email content helper with reason
- Add reasonLabel prop to email template for rejection
- Send approval/rejection emails to custodian

UI changes:
- Add Approve button in actions dropdown for admin/owner
- Add Reject button with dialog requiring rejection reason
- Show rejection reason on booking detail page
- Update checkout button to show for APPROVED bookings
- Update calendar, badge colors, and status helpers
- Update booking process sidebar with approval info
- Disable form fields for REJECTED status

Permission guards:
- Only admin/owner can approve/reject
- Only shown for bookings created by BASE users
- Include creator's org role in loader for detection

https://claude.ai/code/session_01MWiJMghMb6ZB6QVcMy1MUa
@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
shelf-docs Ignored Ignored Feb 6, 2026 3:49pm

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants