Skip to content
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

feat: atoms team booking #14525

Merged
merged 40 commits into from
May 7, 2024
Merged

feat: atoms team booking #14525

merged 40 commits into from
May 7, 2024

Conversation

supalarry
Copy link
Contributor

@supalarry supalarry commented Apr 11, 2024

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.

@graphite-app graphite-app bot requested a review from a team April 11, 2024 12:20
Copy link
Contributor

github-actions bot commented Apr 11, 2024

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

@dosubot dosubot bot added api area: API, enterprise API, access token, OAuth bookings area: bookings, availability, timezones, double booking core area: core, team members only platform Anything related to our platform plan ✨ feature New feature or request labels Apr 11, 2024
@graphite-app graphite-app bot requested a review from a team April 11, 2024 12:20
Copy link

vercel bot commented Apr 11, 2024

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

Copy link
Contributor

github-actions bot commented Apr 11, 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! 🙌

Copy link

deploysentinel bot commented Apr 11, 2024

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: 334811f

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


Copy link

graphite-app bot commented Apr 11, 2024

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.

Comment on lines 63 to 66
entity={{
orgSlug: "ecorp",
considerUnpublished: false,
}}
Copy link
Contributor

Choose a reason for hiding this comment

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

I am wondering what are the potential risk of enabling users to control their orgSlug

@supalarry supalarry merged commit a2620a0 into main May 7, 2024
41 checks passed
@supalarry supalarry deleted the booker-dynamic branch May 7, 2024 12:51
p6l-richard pushed a commit to p6l-richard/cal.com-fork that referenced this pull request Jul 22, 2024
* feat: setup usePublicEvent with orgSlug and duration

* feat: setup useAvailableSlots with eventTypeSlug and orgSlug

* fix & feat: fix TS issues and allow passing multiple users to Booker

* refactor: dont show [15min] [30min] [60min] [1h30min] picker

* fix: pass orgSlug to handleNewBooking -> loadUsers -> findUsersByUsername to not return empty users[]

* refactor: display attendees in booking confirmation screen

* fix: getting slots get orgSlug from props not event

* revert: Booker username use props instead of hardcoded values

* refactor: setup BookerStore org and use it for selectedTime + isDynamic logic

* refactor: hide 'what is this meeting about' input in final booking step

* fix: TS error

* revert: what is the meeting about field hiding

* revert: make org as org? in booker store

* revert: createNewBooking -> loadUsers -> get forced orgSlug from header not body

* refactor: useHandleBookEvent get orgSlug from booker store not props

* fix: if entity undefined dont access orgSlug

* refactor: add isDynamic prop as queryKey for usePublicEvent

* refactor: remove unused prop

* re-add docs

* fix: typescript error

* fix: force platform orgSlug in handleNewBooking.ts

* fix: remove duplicate setSelectedDuration declaration

* refactor: destructure properies from body instead of req.body

* fix: entity optional and hide event members

---------

Co-authored-by: Morgan <[email protected]>
Co-authored-by: Morgan Vernay <[email protected]>
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 platform Anything related to our platform plan teams area: teams, round robin, collective, managed event-types
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants