Skip to content

feat: platform endpoints to fetch/cancel/reschedule bookings and hooks#14164

Merged
emrysal merged 32 commits intomainfrom
fetch-bookings-endpoint-and-hooks
Mar 27, 2024
Merged

feat: platform endpoints to fetch/cancel/reschedule bookings and hooks#14164
emrysal merged 32 commits intomainfrom
fetch-bookings-endpoint-and-hooks

Conversation

@Ryukemeister
Copy link
Copy Markdown
Contributor

@Ryukemeister Ryukemeister commented Mar 21, 2024

What does this PR do?

  • Adds endpoint to fetch all bookings of a user and bookings based on uid
  • Adds hooks for handling fetching of user bookings and bookings based on uid
  • Adds endpoint to reschedule and cancel a booking
  • Adds hooks for handling booking cancellation and rescheduling
  • Adds e2e tests for booking controllers

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 21, 2024

Thank you for following the naming conventions! 🙏 Feel free to join our discord and post your PR link.

@keithwillcode keithwillcode added core area: core, team members only platform Anything related to our platform plan labels Mar 21, 2024
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 21, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

4 Ignored Deployments
Name Status Preview Comments Updated (UTC)
ai ⬜️ Ignored (Inspect) Visit Preview Mar 27, 2024 9:32am
cal ⬜️ Ignored (Inspect) Visit Preview Mar 27, 2024 9:32am
calcom-web-canary ⬜️ Ignored (Inspect) Visit Preview Mar 27, 2024 9:32am
qa ⬜️ Ignored (Inspect) Visit Preview Mar 27, 2024 9:32am

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 21, 2024

📦 Next.js Bundle Analysis for @calcom/web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@deploysentinel
Copy link
Copy Markdown

deploysentinel Bot commented Mar 21, 2024

Current Playwright Test Results Summary

✅ 303 Passing - ⚠️ 11 Flaky

Run may still be in progress, this comment will be updated as current testing workflow or job completes...

(Last updated on 03/27/2024 09:45:53am UTC)

Run Details

Running Workflow PR Update on Github Actions

Commit: 8e9e08f

Started: 03/27/2024 09:42:38am UTC

⚠️ Flakes

📄   apps/web/playwright/availability.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Availablity Can manage single schedule
Retry 2Retry 1Initial Attempt
0% (0) 0 / 182 runs
failed over last 7 days
7.69% (14) 14 / 182 runs
flaked over last 7 days

📄   apps/web/playwright/event-types.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Event Types tests -- future user Different Locations Tests Can add Link Meeting as location and book with it
Retry 1Initial Attempt
0% (0) 0 / 175 runs
failed over last 7 days
5.71% (10) 10 / 175 runs
flaked over last 7 days

📄   apps/web/playwright/integrations-stripe.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Stripe integration Can book a paid booking
Retry 1Initial Attempt
1.66% (3) 3 / 181 runs
failed over last 7 days
36.46% (66) 66 / 181 runs
flaked over last 7 days

📄   packages/embeds/embed-core/playwright/tests/action-based.e2e.ts • 8 Flakes

Top 1 Common Error Messages

null

8 Test Cases Affected

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Popup Tests should open embed iframe on click - Configured with light theme
Retry 1Initial Attempt
0% (0) 0 / 177 runs
failed over last 7 days
59.89% (106) 106 / 177 runs
flaked over last 7 days
Popup Tests should be able to reschedule
Retry 1Initial Attempt
-149.30% (-106) -106 / 71 runs
failed over last 7 days
149.30% (106) 106 / 71 runs
flaked over last 7 days
Popup Tests should open Routing Forms embed on click
Retry 1Initial Attempt
-149.30% (-106) -106 / 71 runs
failed over last 7 days
149.30% (106) 106 / 71 runs
flaked over last 7 days
Popup Tests Floating Button Popup Pro User - Configured in App with default setting of system theme should open embed iframe according to system theme when no theme is configured through Embed API
Retry 1Initial Attempt
-149.30% (-106) -106 / 71 runs
failed over last 7 days
149.30% (106) 106 / 71 runs
flaked over last 7 days
Popup Tests Floating Button Popup Pro User - Configured in App with default setting of system theme should open embed iframe according to system theme when configured with 'auto' theme using Embed API
Retry 1Initial Attempt
-149.30% (-106) -106 / 71 runs
failed over last 7 days
149.30% (106) 106 / 71 runs
flaked over last 7 days
Popup Tests Floating Button Popup Pro User - Configured in App with default setting of system theme should open embed iframe(Booker Profile Page) with dark theme when configured with dark theme using Embed API
Retry 1Initial Attempt
-149.30% (-106) -106 / 71 runs
failed over last 7 days
149.30% (106) 106 / 71 runs
flaked over last 7 days
Popup Tests Floating Button Popup Pro User - Configured in App with default setting of system theme should open embed iframe(Event Booking Page) with dark theme when configured with dark theme using Embed API
Retry 1Initial Attempt
-149.30% (-106) -106 / 71 runs
failed over last 7 days
149.30% (106) 106 / 71 runs
flaked over last 7 days
Popup Tests prendered embed should be loaded and apply the config given to it
Retry 1Initial Attempt
-149.30% (-106) -106 / 71 runs
failed over last 7 days
149.30% (106) 106 / 71 runs
flaked over last 7 days

View Detailed Build Results


// note(Rajiv): currently this endpoint is atoms only
@Get("/:bookingUid")
async getBooking(@Param("bookingUid") bookingUid: string): Promise<ApiResponse<unknown>> {
const { bookingInfo } = await getBookingInfo(bookingUid);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that "getBookingInfo" consists of "prisma.booking.findFirst" call from "apps/web/modules/bookings/views/bookings-single-view.getServerSideProps.tsx" - don't we also need to perform the rest of the operations e.g. eventType that is returned to frontend is transformed into final form in the get server side props:

const eventType = {
    ...eventTypeRaw,
    periodStartDate: eventTypeRaw.periodStartDate?.toString() ?? null,
    periodEndDate: eventTypeRaw.periodEndDate?.toString() ?? null,
    metadata: EventTypeMetaDataSchema.parse(eventTypeRaw.metadata),
    recurringEvent: parseRecurringEvent(eventTypeRaw.recurringEvent),
    customInputs: customInputSchema.array().parse(eventTypeRaw.customInputs),
  };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is done because next.js getServerSideProps can't serialize dates and other data structures

Comment thread apps/web/modules/bookings/lib/getBookingInfo.ts Outdated
@ThyMinimalDev ThyMinimalDev changed the title feat: v2 endpoints to fetch bookings and hooks feat: v2 endpoints to fetch/cancel/reschedule bookings and hooks Mar 27, 2024
@ThyMinimalDev ThyMinimalDev changed the title feat: v2 endpoints to fetch/cancel/reschedule bookings and hooks feat: platform endpoints to fetch/cancel/reschedule bookings and hooks Mar 27, 2024
@ThyMinimalDev ThyMinimalDev requested a review from supalarry March 27, 2024 09:40
@emrysal emrysal merged commit cc21646 into main Mar 27, 2024
@emrysal emrysal deleted the fetch-bookings-endpoint-and-hooks branch March 27, 2024 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core area: core, team members only platform Anything related to our platform plan

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants