feat: useApiV2AvailableSlots (#21138)

* feat: useApiV2AvailableSlots

* feat: useApiV2AvailableSlots

* fix type check

* remove log

* fix unit tests

* simplify

* feat: add missing params to the slots endpoint

* updated documentation

* _shouldServeCache is correct

* fix types

* fix enabled prop

* fix type

* add embedConnectVersion to query key

* add teamId to slot type

* fix

* add fallback to trpc query if apiv2 fails

* add comment

* remove logs

* fix

* refactor: default to isTeamEvent in query params

* fix: only return v2 slots once fetch is success

* fix last e2e failing test

* add feature flag

* add migration sql

* Update packages/prisma/migrations/20250512153630_add_use_api_v2_for_team_slots_feature_flag/migration.sql

---------

Co-authored-by: hbjORbj <[email protected]>
Co-authored-by: Somay Chauhan <[email protected]>
Co-authored-by: supalarry <[email protected]>
Co-authored-by: Keith Williams <[email protected]>
This commit is contained in:
authored and GitHub committed 2025-05-12 20:48:29 +00:00
1 parent ade64c0d09
commit 048e56806c
16 files changed
+218 -46

No files matched your search

@@ -157,7 +157,10 @@ export class SlotsController_2024_04_15 {
@Query() query: GetAvailableSlotsInput_2024_04_15,
@Req() req: ExpressRequest
): Promise<ApiResponse<{ slots: TimeSlots["slots"] | RangeSlots["slots"] }>> {
const isTeamEvent = await this.slotsService.checkIfIsTeamEvent(query.eventTypeId);
const isTeamEvent =
query.isTeamEvent === undefined
? await this.slotsService.checkIfIsTeamEvent(query.eventTypeId)
: query.isTeamEvent;
const availableSlots = await getAvailableSlots({
input: {
...query,
+20 -20
View File
@@ -18293,10 +18293,10 @@
"type": {
"type": "string"
},
"value": {
"option": {
"type": "string"
},
"valueId": {
"optionId": {
"type": "string"
}
},
@@ -18304,8 +18304,8 @@
"id",
"name",
"type",
"value",
"valueId"
"option",
"optionId"
]
},
"NumberAttribute": {
@@ -18320,10 +18320,10 @@
"type": {
"type": "string"
},
"value": {
"option": {
"type": "number"
},
"valueId": {
"optionId": {
"type": "string"
}
},
@@ -18331,8 +18331,8 @@
"id",
"name",
"type",
"value",
"valueId"
"option",
"optionId"
]
},
"SingleSelectAttribute": {
@@ -18347,10 +18347,10 @@
"type": {
"type": "string"
},
"value": {
"option": {
"type": "string"
},
"valueId": {
"optionId": {
"type": "string"
}
},
@@ -18358,23 +18358,23 @@
"id",
"name",
"type",
"value",
"valueId"
"option",
"optionId"
]
},
"MultiSelectAttributeValue": {
"MultiSelectAttributeOption": {
"type": "object",
"properties": {
"valueId": {
"optionId": {
"type": "string"
},
"value": {
"option": {
"type": "string"
}
},
"required": [
"valueId",
"value"
"optionId",
"option"
]
},
"MultiSelectAttribute": {
@@ -18389,10 +18389,10 @@
"type": {
"type": "string"
},
"values": {
"options": {
"type": "array",
"items": {
"$ref": "#/components/schemas/MultiSelectAttributeValue"
"$ref": "#/components/schemas/MultiSelectAttributeOption"
}
}
},
@@ -18400,7 +18400,7 @@
"id",
"name",
"type",
"values"
"options"
]
},
"MembershipUserOutputDto": {
@@ -6,6 +6,7 @@ import type { GetBookingType } from "@calcom/features/bookings/lib/get-booking";
import { getBookingForReschedule } from "@calcom/features/bookings/lib/get-booking";
import { getSlugOrRequestedSlug, orgDomainConfig } from "@calcom/features/ee/organizations/lib/orgDomains";
import { getOrganizationSEOSettings } from "@calcom/features/ee/organizations/lib/orgSettings";
import { FeaturesRepository } from "@calcom/features/flags/features.repository";
import { getPlaceholderAvatar } from "@calcom/lib/defaultAvatarImage";
import slugify from "@calcom/lib/slugify";
import prisma from "@calcom/prisma";
@@ -113,8 +114,12 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
const organizationSettings = getOrganizationSEOSettings(team);
const allowSEOIndexing = organizationSettings?.allowSEOIndexing ?? false;
const featureRepo = new FeaturesRepository();
const useApiV2 = await featureRepo.checkIfTeamHasFeature(team.id, "use-api-v2-for-team-slots");
return {
props: {
useApiV2,
eventData: {
eventTypeId,
entity: {
+2
View File
@@ -35,6 +35,7 @@ function Type({
crmOwnerRecordType,
crmAppSlug,
isEmbed,
useApiV2,
}: PageProps) {
const searchParams = useSearchParams();
@@ -42,6 +43,7 @@ function Type({
<BookingPageErrorBoundary>
<main className={getBookerWrapperClasses({ isEmbed: !!isEmbed })}>
<Booker
useApiV2={useApiV2}
username={user}
eventSlug={slug}
bookingData={booking}