* migration and init to accept creationSource for new bookings * V1 create booking * V1 user creation * webapp booking + V1 user * user creation in V1, V2 and webapp * booking source V2 and fix for v1 user * fit type * --fix type * add test -- WIP * fix type * fix type * ^ * Need more sleep zzz * -_- * bump libraries platform * adds for v2 recurring booking * fix lint * instant meetings * fix: api v2 creation source * fixup! fix: api v2 creation source * bump libraries * add user * fix test * fixup! fix test * add more source * more source... * fix type & test --1 * fix type & test --2 * typefix * fixup test --------- Co-authored-by: Morgan Vernay <morgan@cal.com>
67 lines
1.7 KiB
TypeScript
67 lines
1.7 KiB
TypeScript
import { getDate } from "@calcom/web/test/utils/bookingScenario/bookingScenario";
|
|
|
|
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,
|
|
hashedLink: null,
|
|
};
|
|
}
|
|
|
|
type CommonPropsMockRequestData = {
|
|
rescheduleUid?: string;
|
|
bookingUid?: string;
|
|
recurringEventId?: string;
|
|
recurringCount?: number;
|
|
rescheduledBy?: string;
|
|
cancelledBy?: string;
|
|
schedulingType?: SchedulingType;
|
|
responses: {
|
|
email: string;
|
|
name: string;
|
|
location?: { optionValue: ""; value: string };
|
|
attendeePhoneNumber?: string;
|
|
smsReminderNumber?: string;
|
|
};
|
|
};
|
|
|
|
export function getMockRequestDataForBooking({
|
|
data,
|
|
}: {
|
|
data: Partial<ReturnType<typeof getBasicMockRequestDataForBooking>> & {
|
|
eventTypeId: number;
|
|
user?: string;
|
|
creationSource?: CreationSource;
|
|
} & CommonPropsMockRequestData;
|
|
}) {
|
|
return {
|
|
...getBasicMockRequestDataForBooking(),
|
|
...data,
|
|
};
|
|
}
|
|
|
|
export function getMockRequestDataForDynamicGroupBooking({
|
|
data,
|
|
}: {
|
|
data: Partial<ReturnType<typeof getBasicMockRequestDataForBooking>> & {
|
|
eventTypeId: 0;
|
|
eventTypeSlug: string;
|
|
user: string;
|
|
} & CommonPropsMockRequestData;
|
|
}) {
|
|
return {
|
|
...getBasicMockRequestDataForBooking(),
|
|
...data,
|
|
};
|
|
}
|