fix: Ensure event type duplication respects private link setting (#13438)

* fix: Ensure event type duplication respects private link setting

* chode refactor

* Fix: Handler throwing error on creating duplicate of a collective event having private-link switched on.

---------

Co-authored-by: Keith Williams <[email protected]>
This commit is contained in:
Somay ChauhanandKeith Williams authored and GitHub committed 2024-02-07 09:30:28 +01:00
1 parent d2b4760e3a
commit a0451e34c1
4 files changed
+25 -18

No files matched your search

@@ -1,22 +1,14 @@
import type { Prisma } from "@prisma/client";
import short from "short-uuid";
import { v5 as uuidv5 } from "uuid";
import type { DeepMockProxy } from "vitest-mock-extended";
import { sendSlugReplacementEmail } from "@calcom/emails/email-manager";
import { generateHashedLink } from "@calcom/lib/generateHashedLink";
import { getTranslation } from "@calcom/lib/server/i18n";
import type { PrismaClient } from "@calcom/prisma";
import { SchedulingType } from "@calcom/prisma/enums";
import { _EventTypeModel } from "@calcom/prisma/zod";
import { allManagedEventTypeProps, unlockedManagedEventTypeProps } from "@calcom/prisma/zod-utils";
const generateHashedLink = (id: number) => {
const translator = short();
const seed = `${id}:${new Date().getTime()}`;
const uid = translator.fromUUID(uuidv5(seed, uuidv5.URL));
return uid;
};
interface handleChildrenEventTypesProps {
eventTypeId: number;
profileId: number | null;