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:
16 files changed
+218
-46
No files matched your search
@@ -158,6 +158,7 @@ export const BookerWebWrapper = (props: BookerWebWrapperAtomProps) => {
|
||||
teamMemberEmail: props.teamMemberEmail,
|
||||
fromRedirectOfNonOrgLink: props.entity.fromRedirectOfNonOrgLink,
|
||||
isTeamEvent: props.isTeamEvent ?? !!event.data?.team,
|
||||
useApiV2: props.useApiV2,
|
||||
});
|
||||
const bookings = useBookings({
|
||||
event,
|
||||
|
||||
@@ -15,7 +15,7 @@ export const QUERY_KEY = "get-available-slots";
|
||||
export const useAvailableSlots = ({
|
||||
enabled,
|
||||
...rest
|
||||
}: GetAvailableSlotsInput_2024_04_15 & { enabled: boolean; isTeamEvent?: boolean; teamId?: number }) => {
|
||||
}: GetAvailableSlotsInput_2024_04_15 & { enabled: boolean }) => {
|
||||
const availableSlots = useQuery({
|
||||
queryKey: [
|
||||
QUERY_KEY,
|
||||
@@ -28,7 +28,7 @@ export const useAvailableSlots = ({
|
||||
rest.usernameList,
|
||||
rest.routedTeamMemberIds,
|
||||
rest.skipContactOwner,
|
||||
rest.shouldServeCache,
|
||||
rest._shouldServeCache,
|
||||
rest.teamMemberEmail,
|
||||
],
|
||||
queryFn: () => {
|
||||
|
||||
@@ -129,6 +129,50 @@ export class GetAvailableSlotsInput_2024_04_15 {
|
||||
@IsOptional()
|
||||
@ApiPropertyOptional()
|
||||
teamMemberEmail?: string;
|
||||
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
@ApiPropertyOptional()
|
||||
@ApiHideProperty()
|
||||
embedConnectVersion?: string;
|
||||
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
@ApiPropertyOptional()
|
||||
@ApiHideProperty()
|
||||
email?: string | null;
|
||||
|
||||
@Transform(({ value }: { value: string }) => value && parseInt(value))
|
||||
@IsNumber()
|
||||
@IsOptional()
|
||||
@Min(1, { message: "routingFormResponseId must be a positive number" })
|
||||
@ApiPropertyOptional()
|
||||
@ApiHideProperty()
|
||||
routingFormResponseId?: number;
|
||||
|
||||
@Transform(({ value }) => value && value.toLowerCase() === "true")
|
||||
@IsBoolean()
|
||||
@IsOptional()
|
||||
@ApiHideProperty()
|
||||
_shouldServeCache?: boolean;
|
||||
|
||||
@Transform(({ value }) => value && value.toLowerCase() === "true")
|
||||
@IsBoolean()
|
||||
@IsOptional()
|
||||
@ApiHideProperty()
|
||||
_bypassCalendarBusyTimes?: boolean;
|
||||
|
||||
@Transform(({ value }) => (value ? value.toLowerCase() === "true" : false))
|
||||
@IsBoolean()
|
||||
@IsOptional()
|
||||
@ApiHideProperty()
|
||||
isTeamEvent?: boolean;
|
||||
|
||||
@Transform(({ value }: { value: string }) => value && parseInt(value))
|
||||
@IsNumber()
|
||||
@IsOptional()
|
||||
@ApiHideProperty()
|
||||
teamId?: number;
|
||||
}
|
||||
|
||||
export class RemoveSelectedSlotInput_2024_04_15 {
|
||||
|
||||
Reference in new issue
Block a user