-
Notifications
You must be signed in to change notification settings - Fork 8.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: v2 bookings #16200
Merged
Merged
refactor: v2 bookings #16200
Conversation
This file contains 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
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Skipped Deployments
|
👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎ This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored. |
ThyMinimalDev
approved these changes
Sep 23, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
api
area: API, enterprise API, access token, OAuth
bookings
area: bookings, availability, timezones, double booking
core
area: core, team members only
✨ feature
New feature or request
Medium priority
Created by Linear-GitHub Sync
platform
Anything related to our platform plan
ready-for-e2e
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.
To use this version add
cal-api-version: 2024-08-13
request header.This PR versions existing bookings endpoints under 2024-04-15/controllers/bookings.controller.ts and introduces new endpoints under bookings/2024-08-13/controllers/bookings.controller.ts. There are following endpoints:
2024-08-13/controllers/bookings.controller.e2e-spec.ts tests all of these features and also team event type bookings.
Fixes #16512
1. Create booking, recurring booking and instant booking
POST /v2/bookings is used to create regular bookings, recurring bookings and instant bookings. The request bodies for all 3 are almost the same except:
eventTypeId
in the request body is id of a regular event, then regular booking is created. If it is an id of a recurring event type, then recurring booking is created. Meaning that the request bodies are equal but the outcome depends on what kind of event type it is with the goal of making it as seamless for developers as possible."instant": true
to the request body.start
needs to be in UTC aka if the timezone is GMT+2 in Rome and meeting should start at 11, then UTC time should have hours 09:00 aka without time zone.Booking
Request body:
Response:
Recurring booking
The eventTypeId equals to recurring event type.
Request body:
Response:
Instant Booking
The "eventTypeId" must be a team event type and simply add
"instant" : true
to the request body.Request:
2. Get booking, recurring booking, or individual recurrence of recurring booking by uid
Similarly, getting bookings has been simplified. Fetch booking using GET
/v2/bookings/:bookingUid
. The:bookingUid
can be:uid of a regular booking above e.g. "r66HAHqdmsfUAKxr6yXfjh" above.
uid of one of the recurrences within recurring bookings e.g. "1pvo6RVzqbgr1hhP6AV4qB" above (if its recurring booking with 3 recurrences, then return will be 1 object containing 1 of the 3 occurences)
uid of the recurring booking e.g. "89e7ef26-ec0b-4898-9733-6488264ac438” above stored in the
recurringBookingUid
key (will return an array of all 3 recurrences)GET normal booking
api/v2/bookings/r66HAHqdmsfUAKxr6yXfjh
response:api/v2/bookings/1pvo6RVzqbgr1hhP6AV4qB
response:As you see it has
recurringBookingUid
key.api/v2/bookings/89e7ef26-ec0b-4898-9733-6488264ac438
response:3. Get all bookings using filters
Now let’s see how can we fetch multiple bookings and filters we can use. If you send GET
/v2/bookings
then you will see all bookings created (1 normal booking + 3 recurrences of a recurring booking). Notably, by default it returns upcoming bookings sorted by soonest meeting on the top.You can use filters, sorting and pagination query parameters to fetch results as you want.
filters:
?status=upcoming
. Notably, you can pass multiple statuses?status=past,cancelled
which will return past and cancelled meetings.[email protected]
?attendeeName=lauris
?eventTypeIds=3686,3687
?eventTypeId=3686
?teamIds=686,687
?teamId=686
?afterStart=2025-03-07T10:00:00.000Z
?beforeEnd=2025-03-07T11:00:00.000Z
sort:
?sortStart=asc
or descending?sortStart=desc
order.?sortEnd=asc
or descending?sortEnd=desc
order.?sortCreated=asc
or descending?sortCreated=desc
order.pagination:
4. Reschedule booking
It is possible to reschedule a regular booking or one of the recurrences of a recurring booking by sending a POST request to
api/v2/bookings/:bookingUid/reschedule
. After rescheduling the new booking will contain referencerescheduledFromUid
andrescheduledReason
provided in request body.1. Reschedule normal booking
Request:
api/v2/bookings/qM56A2BTnwCKuhitWc1pH5/reschedule
Body: provide new start time in UTC and optionally rescheduling reason:
Response:
2. Reschedule recurrence of a recurring event
Request URL: api/v2/bookings/1pvo6RVzqbgr1hhP6AV4qB/reschedule
Body:
Response:
If we now fetch the recurring booking that has 3 occurences by recurringBookingUid
ce796451-9ca0-453e-bf1c-976f4245b08d
then we will have array of 4 entries - 1 was changed to status = cancelled aka the one that was rescheduled and there is now a new 4th entry as a reason of the reschedule.5. Cancel booking
Make request to
v2/bookings/:bookingUid/cancel
. If :bookingUid is equal torecurringBookingUid
of a recurrence of a recurring booking, then all remaining recurrences will be cancelled.6. Mark host or attendee as absent
Request URL: api/v2/bookings/:bookingUid/mark-absent
Body to mark host absent:
Body to mark one of the attendees absent:
Tests