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: Add booking and user creation source #18768

Draft
wants to merge 26 commits into
base: main
Choose a base branch
from

Conversation

alishaz-polymath
Copy link
Member

@alishaz-polymath alishaz-polymath commented Jan 20, 2025

What does this PR do?

Add booking and user creation source to be able to identify where a booking or a user creation was requested from (API V1, API V2, Webapp)

  • Fixes #XXXX (GitHub issue number)
  • Fixes CAL-XXXX (Linear issue number - should be visible at the bottom of the GitHub issue description)

Mandatory Tasks (DO NOT REMOVE)

  • N/A I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • N/A I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  • Make bookings via Webapp, V1 and V2 and notice the creationSource in the DB reflect the same.
  • Make user via Webapp, V1 and V2 and notice the creationSource in the DB reflect the same.

Follow-up

I noticed that we're not running any tests in apps/api/v1/test/lib/bookings/_post.test.ts and I'll take care of that as a follow up, including test for the changes here. I have manually confirmed that v1 is working for this, so it should be okay as a follow up, gives me more time to fix that entire suite properly.

@github-actions github-actions bot added the ❗️ migrations contains migration files label Jan 20, 2025
@keithwillcode keithwillcode added core area: core, team members only enterprise area: enterprise, audit log, organisation, SAML, SSO labels Jan 20, 2025
Copy link

vercel bot commented Jan 21, 2025

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

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
cal ⬜️ Ignored (Inspect) Visit Preview Jan 22, 2025 2:48am
calcom-web-canary ⬜️ Ignored (Inspect) Visit Preview Jan 22, 2025 2:48am

@dosubot dosubot bot added the ✨ feature New feature or request label Jan 21, 2025
@alishaz-polymath alishaz-polymath marked this pull request as draft January 21, 2025 11:54
Copy link

graphite-app bot commented Jan 21, 2025

Graphite Automations

"Add foundation team as reviewer" took an action on this PR • (01/21/25)

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

@alishaz-polymath alishaz-polymath marked this pull request as ready for review January 21, 2025 11:55
@@ -366,6 +372,7 @@ model User {
updatedTranslations EventTypeTranslation[] @relation("UpdatedEventTypeTranslations")
createdWatchlists Watchlist[] @relation("CreatedWatchlists")
updatedWatchlists Watchlist[] @relation("UpdatedWatchlists")
creationSource CreationSource?
Copy link
Member Author

Choose a reason for hiding this comment

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

We don't provide a default here to ensure we have all our bases covered. Any null value here for new users should tell us that we might have missed a route.

@@ -668,6 +675,7 @@ model Booking {
// Ah, made a typo here. Should have been routedFromRoutingFormRe"s"ponse. Live with it :(
routedFromRoutingFormReponse App_RoutingForms_FormResponse?
assignmentReason AssignmentReason[]
creationSource CreationSource?
Copy link
Member Author

Choose a reason for hiding this comment

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

We don't provide a default here to ensure we have all our bases covered. Any null value here for new users should tell us that we might have missed a route.

@@ -0,0 +1,8 @@
-- CreateEnum
CREATE TYPE "CreationSource" AS ENUM ('api_v1', 'api_v2', 'webapp');
Copy link
Member Author

Choose a reason for hiding this comment

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

We don't have Platform as enum here because that inherently uses API V2, and after discussion with @ThyMinimalDev it felt unnecessary to have platform here.

Copy link
Contributor

Choose a reason for hiding this comment

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

@emrysal @zomars I see we have a mixture of upper-case and lower-case enum values in our schema. What's the preference?

Copy link
Member

Choose a reason for hiding this comment

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

I think uppercase is the most used one

Copy link

socket-security bot commented Jan 21, 2025

👍 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.

View full report↗︎

Copy link
Contributor

@Udit-takkar Udit-takkar left a comment

Choose a reason for hiding this comment

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

Tried inviting a user to org by email and "copy invite link" but creationSource field was null

@github-actions github-actions bot marked this pull request as draft January 21, 2025 18:30
Copy link

New, updated, and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher

🚮 Removed packages: npm/@formkit/[email protected], npm/[email protected]

View full report↗︎

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 enterprise area: enterprise, audit log, organisation, SAML, SSO ✨ feature New feature or request ❗️ migrations contains migration files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants