feat: add request reschedule API v2 endpoint#28243
Closed
PeerRich wants to merge 2 commits into
Closed
Conversation
Add POST /v2/bookings/:bookingUid/request-reschedule endpoint that allows requesting a reschedule for an existing booking with an optional reason message. - Create RequestRescheduleInput_2024_08_13 DTO with optional rescheduleReason field - Create RequestRescheduleOutput_2024_08_13 output type - Add requestReschedule service method in BookingsService_2024_08_13 - Add controller endpoint with proper guards and Swagger docs - Re-export requestRescheduleHandler from platform-libraries - Export new input from platform-types index Co-Authored-By: peer@cal.com <peer@cal.com>
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
- Test request reschedule with a reason message - Test request reschedule without a reason - Test that cancelled bookings cannot be rescheduled (400) - Test that non-existent booking UIDs return 404 - Export reschedule email classes from platform-libraries for mocking Co-Authored-By: peer@cal.com <peer@cal.com>
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.
What does this PR do?
Adds a new
POST /v2/bookings/:bookingUid/request-rescheduleendpoint that allows requesting a reschedule for an existing booking, with an optionalrescheduleReasonmessage. This exposes the existing tRPCrequestRescheduleHandleras a REST API v2 endpoint.The endpoint cancels the current booking and sends the attendee an email with a link to reschedule.
Changes
RequestRescheduleInput_2024_08_13): OptionalrescheduleReasonstring fieldRequestRescheduleOutput_2024_08_13): Returns{ status: "success" }requestReschedule()inBookingsService_2024_08_13— validates booking exists, delegates torequestRescheduleHandlerPOST /:bookingUid/request-reschedulewithBOOKING_WRITEpermission,ApiAuthGuard+BookingUidGuardrequestRescheduleHandlerfrom tRPC and reschedule email classes for use in API v2Type mismatch:
requestRescheduleHandlerexpectsNonNullable<TrpcSessionUser>but receivesApiAuthGuardUser. At runtime the handler only uses fields present on both types (id,email,locale,profile,uuid,username,timeZone,name,phoneNumber), but this is a compile-time type error. Note: the same pre-existing mismatch exists forconfirmBookingHandlercalls at lines 1232 and 1266 of the same service file.Response does not include booking data: Unlike
confirm/declinewhich return the updated booking, this endpoint returns only{ status }because the underlying handler returns void. Should we fetch and return the (now-cancelled) booking for consistency?Redundant booking lookup: The service checks the booking exists, but
BookingUidGuardand the handler itself also look up the booking internally.Mandatory Tasks (DO NOT REMOVE)
How should this be tested?
POST /v2/bookings/{bookingUid}/request-reschedulewith headercal-api-version: 2024-08-13{ "rescheduleReason": "Need to move this meeting" }(optional){ "status": "success" }CANCELLEDwithrescheduled: trueBOOKING_CANCELLEDwebhook is triggeredE2e tests included:
Checklist
Link to Devin Session: https://app.devin.ai/sessions/34dc36cca5a14662911130c2ea689d94
Requested by: @PeerRich