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: Implement global booking limits #14243

Open
wants to merge 34 commits into
base: main
Choose a base branch
from

Conversation

asadath1395
Copy link
Contributor

@asadath1395 asadath1395 commented Mar 28, 2024

What does this PR do?

Fixes #8985

Type of change

  • New feature (non-breaking change which adds functionality)

Mandatory Tasks

  • Make sure you have self-reviewed the code. A decent size PR without self-review might be rejected.

@asadath1395 asadath1395 marked this pull request as draft March 28, 2024 07:04
Copy link

vercel bot commented Mar 28, 2024

@asadath1395 is attempting to deploy a commit to the cal Team on Vercel.

A member of the Team first needs to authorize it.

@graphite-app graphite-app bot added the community Created by Linear-GitHub Sync label Mar 28, 2024
@graphite-app graphite-app bot requested a review from a team March 28, 2024 07:04
Copy link
Contributor

github-actions bot commented Mar 28, 2024

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

@github-actions github-actions bot added event-types area: event types, event-types Medium priority Created by Linear-GitHub Sync ✨ feature New feature or request labels Mar 28, 2024
Copy link

graphite-app bot commented Mar 28, 2024

Graphite Automations

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

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

"Add community label" took an action on this PR • (03/28/24)

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

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

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

Copy link
Contributor

github-actions bot commented Mar 28, 2024

📦 Next.js Bundle Analysis for @calcom/web

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

New Page Added

The following page was added to the bundle from the code in this PR:

Page Size (compressed) First Load % of Budget (350 KB)
/settings/my-account/bookings 311.71 KB 540.14 KB 154.33%

@keithwillcode keithwillcode added this to the v4.0 milestone Mar 28, 2024
@github-actions github-actions bot added the ❗️ migrations contains migration files label Mar 29, 2024
@dosubot dosubot bot modified the milestones: v4.0, v4.1 Apr 15, 2024
@keithwillcode keithwillcode modified the milestones: v4.0, v4.1 Apr 15, 2024
@github-actions github-actions bot added the Stale label Jul 4, 2024
@dosubot dosubot bot removed this from the v4.4 milestone Jul 16, 2024
@Amit91848 Amit91848 added the high-risk Requires approval by Foundation team label Jul 22, 2024
@keithwillcode
Copy link
Contributor

This PR is being closed due to a lack of activity. Please reopen if work is to continue.

@dosubot dosubot bot added this to the v4.5 milestone Aug 19, 2024
@dosubot dosubot bot modified the milestones: v4.5, v4.6 Sep 9, 2024
@asadath1395
Copy link
Contributor Author

@CarinaWolli Since you are working on global booking limits for teams #16557, 2nd point here #14243 (review) is not applicable for this PR, right?

@asadath1395
Copy link
Contributor Author

@keithwillcode Could you please re-open this PR? I would like to continue the work here

@keithwillcode keithwillcode modified the milestones: v4.6, v4.5 Sep 15, 2024
@Amit91848 Amit91848 reopened this Sep 17, 2024
@CarinaWolli
Copy link
Member

@CarinaWolli Since you are working on global booking limits for teams #16557, 2nd point here #14243 (review) is not applicable for this PR, right?

Yes you are right, we changed that. We only want to count the user's bookings including bookings from managed event types, but not bookings from other team event types (collective, round-robin)

@asadath1395 asadath1395 marked this pull request as ready for review September 25, 2024 12:09
Copy link
Member

@CarinaWolli CarinaWolli left a comment

Choose a reason for hiding this comment

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

Didn't test this yet, but I found some issues in the code that need to be addressed first. We also need to add tests for this, probably best inside global-booking-limits.test.ts

@@ -30,6 +30,7 @@ const tabs: VerticalTabItemProps[] = [
{ name: "general", href: "/settings/my-account/general" },
{ name: "calendars", href: "/settings/my-account/calendars" },
{ name: "conferencing", href: "/settings/my-account/conferencing" },
{ name: "bookings", href: "/settings/my-account/bookings" },
Copy link
Member

Choose a reason for hiding this comment

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

Should be my-account/bookingLimits and tab also should be shown as 'Booking Limits'

undefined,
rescheduleUid,
eventType.schedule?.timeZone,
userId
Copy link
Member

Choose a reason for hiding this comment

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

userId isn't a parameter of checkBookingLimits

Comment on lines 62 to 63
title={t("bookings")}
description={t("bookings_settings_description", { appName: APP_NAME })}
Copy link
Member

Choose a reason for hiding this comment

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

title: Booking Limits
description: Set global limits for when and how often you can be booked

} else {
bookingsLimitFormMethods.setValue("bookingLimits", {});
}
handleSubmit(bookingsLimitFormMethods.getValues());
Copy link
Member

Choose a reason for hiding this comment

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

toast is missing when enabling/disabling toggle

rescheduleUid,
bookingLimits,
durationLimits,
globalBookingLimits,
Copy link
Member

Choose a reason for hiding this comment

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

globalBookingLimits isn't in of params

let eventTypeIdFilter: Prisma.BookingWhereInput = { eventTypeId };
if (globalBookingLimits) {
if (bookingLimits && Object.keys(bookingLimits).length > 0) {
eventTypeIdFilter = { eventTypeId: { not: eventTypeId } };
Copy link
Member

Choose a reason for hiding this comment

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

what's that filter for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was added earlier as i had a different implementation in place, removed it now as implementation has changed.

@asadath1395
Copy link
Contributor Author

@CarinaWolli Added tests and addressed all the comments from above. Could you please review this PR again?

Thanks!!

@asadath1395
Copy link
Contributor Author

@CarinaWolli Please review this PR once you are free. Thanks!

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 community Created by Linear-GitHub Sync event-types area: event types, event-types ✨ feature New feature or request high-risk Requires approval by Foundation team Medium priority Created by Linear-GitHub Sync ❗️ migrations contains migration files Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CAL-1724] Allow global booking limits
5 participants