82951cd04e
* chore: Move post booking stuff to separate service * refactor: improve ISP compliance in BookingEventHandlerService - Refactor updatePrivateLinkUsage to only accept hashedLink parameter instead of full payload - Remove shouldProcess function and inline isDryRun check for better clarity - Addresses feedback from PR #24025 Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * define only what is used * Define hashed-link-service as well in api-v2 * fix: export HashedLinkService through platform-libraries - Add HashedLinkService to platform-libraries/private-links.ts - Update API V2 to import from platform library instead of direct path - Fixes MODULE_NOT_FOUND error in API V2 build Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Morgan <33722304+ThyMinimalDev@users.noreply.github.com>
72 lines
1.9 KiB
TypeScript
72 lines
1.9 KiB
TypeScript
import { getDate } from "@calcom/web/test/utils/bookingScenario/bookingScenario";
|
|
|
|
import type { Tracking } from "@calcom/features/bookings/lib/handleNewBooking/types";
|
|
import type { SchedulingType } from "@calcom/prisma/client";
|
|
import type { CreationSource } from "@calcom/prisma/enums";
|
|
|
|
export const DEFAULT_TIMEZONE_BOOKER = "Asia/Kolkata";
|
|
export function getBasicMockRequestDataForBooking() {
|
|
return {
|
|
start: `${getDate({ dateIncrement: 1 }).dateString}T04:00:00.000Z`,
|
|
end: `${getDate({ dateIncrement: 1 }).dateString}T04:30:00.000Z`,
|
|
eventTypeSlug: "no-confirmation",
|
|
timeZone: DEFAULT_TIMEZONE_BOOKER,
|
|
language: "en",
|
|
user: "teampro",
|
|
metadata: {},
|
|
hasHashedBookingLink: false,
|
|
};
|
|
}
|
|
|
|
type CommonPropsMockRequestData = {
|
|
rescheduleUid?: string;
|
|
bookingUid?: string;
|
|
recurringEventId?: string;
|
|
recurringCount?: number;
|
|
rescheduledBy?: string;
|
|
cancelledBy?: string;
|
|
schedulingType?: SchedulingType;
|
|
guests?: string[];
|
|
responses: {
|
|
email: string;
|
|
name: string;
|
|
location?: { optionValue: ""; value: string };
|
|
attendeePhoneNumber?: string;
|
|
smsReminderNumber?: string;
|
|
};
|
|
_isDryRun?: boolean;
|
|
hashedLink?: string;
|
|
hasHashedBookingLink?: boolean;
|
|
};
|
|
|
|
export function getMockRequestDataForBooking({
|
|
data,
|
|
}: {
|
|
data: Partial<ReturnType<typeof getBasicMockRequestDataForBooking>> & {
|
|
eventTypeId: number;
|
|
user?: string;
|
|
creationSource?: CreationSource;
|
|
tracking?: Tracking;
|
|
} & CommonPropsMockRequestData;
|
|
}) {
|
|
return {
|
|
...getBasicMockRequestDataForBooking(),
|
|
...data,
|
|
};
|
|
}
|
|
|
|
export function getMockRequestDataForDynamicGroupBooking({
|
|
data,
|
|
}: {
|
|
data: Partial<ReturnType<typeof getBasicMockRequestDataForBooking>> & {
|
|
eventTypeId: 0;
|
|
eventTypeSlug: string;
|
|
user: string;
|
|
} & CommonPropsMockRequestData;
|
|
}) {
|
|
return {
|
|
...getBasicMockRequestDataForBooking(),
|
|
...data,
|
|
};
|
|
}
|