cal.com icon indicating copy to clipboard operation
cal.com copied to clipboard

feat: atoms team booking

Open supalarry opened this issue 10 months ago • 5 comments

Use dynamic bookings logic to simulate a team event using atoms booker.

For PlatformBookerWrapper to act as a team booking we need:

  1. username array containing usernames to book the booking with
  2. entity containing orgSlug
  3. duration of the event
        <Booker
            eventSlug={eventTypeSlug}
            username={[
              "npwruvxgpl-clujvibu30001khltnifvcca8-example",
              "dpgobfhtli-Clujvibu30001khltnifvcca8-example",
            ]}
            onCreateBookingSuccess={(data) => {
              setBookingTitle(data.data.title);
              router.push(`/${data.data.uid}`);
            }}
            duration={eventTypeDuration}
            entity={{
              orgSlug: "ecorp",
              considerUnpublished: false,
            }}
          />

❗ Forced slug - important to enable feature

When booking atom makes a booking, it calls v2 bookings.controller.ts which calls handleNewBooking.ts which calls loadUsers, which calls orgDomainConfig which returns orgSlug and if it's valid. The orgSlug is based on organization subdomain e.g. acme.cal.com, and is created so that someone booking acme organization does not book another organization.

Platform teams do not have subdomains, so we can enforce orgSlug that is necessary for handleNewBooking.ts to work by:

  1. Providing x-cal-client-id request header to note that request is coming from platform.
  2. Providing x-cal-force-slug request header as a way to pass the enforced orgSlug, which is passed to Booker atom via "entity.orgSlug prop".

Implemented in fix: force platform orgSlug in handleNewBooking.ts and confirmed with Hariom that approach of client ID + enforced slug as headers is fine.

supalarry avatar Apr 11 '24 12:04 supalarry

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

github-actions[bot] avatar Apr 11 '24 12:04 github-actions[bot]

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

Name Status Preview Comments Updated (UTC)
platform-starter-kit ❌ Failed (Inspect) May 7, 2024 0:07am
5 Ignored Deployments
Name Status Preview Comments Updated (UTC)
ai ⬜️ Ignored (Inspect) Visit Preview May 7, 2024 0:07am
cal ⬜️ Ignored (Inspect) Visit Preview May 7, 2024 0:07am
calcom-web-canary ⬜️ Ignored (Inspect) Visit Preview May 7, 2024 0:07am
qa ⬜️ Ignored (Inspect) Visit Preview May 7, 2024 0:07am
qa-not-in-use ⬜️ Ignored (Inspect) Visit Preview May 7, 2024 0:07am

vercel[bot] avatar Apr 11 '24 12:04 vercel[bot]

📦 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! 🙌

github-actions[bot] avatar Apr 11 '24 12:04 github-actions[bot]

Current Playwright Test Results Summary

✅ 37 Passing - ⚠️ 2 Flaky

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

(Last updated on 05/07/2024 12:49:40pm UTC)

Run Details

Running Workflow PR Update on Github Actions

Commit: 334811fb861d52f19ad8335a807ea572f15bfe88

Started: 05/07/2024 12:47:47pm UTC

⚠️ Flakes

📄   apps/web/playwright/profile.e2e.ts • 2 Flakes

Top 1 Common Error Messages

null

2 Test Cases Affected

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Update Profile Can update a users email (verification enabled)
Retry 2Retry 1Initial Attempt
19.81% (63) 63 / 318 runs
failed over last 7 days
32.39% (103) 103 / 318 runs
flaked over last 7 days
Update Profile Newly added secondary email should show as Unverified
Retry 1Initial Attempt
0.94% (3) 3 / 319 runs
failed over last 7 days
11.29% (36) 36 / 319 runs
flaked over last 7 days

View Detailed Build Results


deploysentinel[bot] avatar Apr 11 '24 12:04 deploysentinel[bot]

Graphite Automations

"Add consumer team as reviewer" took an action on this PR • (04/11/24)

1 reviewer was added to this PR based on Keith Williams's automation.

"Add platform team as reviewer" took an action on this PR • (04/11/24)

1 reviewer was added to this PR based on Keith Williams's automation.

graphite-app[bot] avatar Apr 11 '24 12:04 graphite-app[bot]