fix: duplicate dialog (#14055)
This commit is contained in:
1 parent
0efe25feb4
commit
1482d9a9af
4 files changed
+14
-11
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useForm } from "react-hook-form";
|
||||
@@ -10,6 +11,7 @@ import { HttpError } from "@calcom/lib/http-error";
|
||||
import { md } from "@calcom/lib/markdownIt";
|
||||
import slugify from "@calcom/lib/slugify";
|
||||
import turndown from "@calcom/lib/turndownService";
|
||||
import { EventTypeDuplicateInput } from "@calcom/prisma/zod/custom/eventtype";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
import {
|
||||
Button,
|
||||
@@ -24,7 +26,7 @@ import {
|
||||
} from "@calcom/ui";
|
||||
|
||||
const querySchema = z.object({
|
||||
title: z.string(),
|
||||
title: z.string().min(1),
|
||||
description: z.string().default(""),
|
||||
slug: z.string(),
|
||||
id: z.coerce.number(),
|
||||
@@ -47,6 +49,7 @@ const DuplicateDialog = () => {
|
||||
slug: t("event_type_duplicate_copy_text", { slug }),
|
||||
...defaultValues,
|
||||
},
|
||||
resolver: zodResolver(EventTypeDuplicateInput),
|
||||
});
|
||||
const { register } = form;
|
||||
|
||||
|
||||
@@ -20,3 +20,11 @@ export const createEventTypeInput = z.object({
|
||||
path: ["schedulingType"],
|
||||
message: "You must select a scheduling type for team events",
|
||||
});
|
||||
|
||||
export const EventTypeDuplicateInput = z.object({
|
||||
id: z.number(),
|
||||
slug: z.string(),
|
||||
title: z.string().min(1),
|
||||
description: z.string(),
|
||||
length: z.number(),
|
||||
}).strict();
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { z } from "zod";
|
||||
|
||||
import { EventTypeDuplicateInput } from "./types";
|
||||
import { EventTypeDuplicateInput } from "@calcom/prisma/zod/custom/eventtype";
|
||||
|
||||
export const ZDuplicateInputSchema = EventTypeDuplicateInput.strict();
|
||||
export const ZDuplicateInputSchema = EventTypeDuplicateInput;
|
||||
|
||||
export type TDuplicateInputSchema = z.infer<typeof ZDuplicateInputSchema>;
|
||||
@@ -55,11 +55,3 @@ export const EventTypeUpdateInput = _EventTypeModel
|
||||
id: true,
|
||||
})
|
||||
);
|
||||
|
||||
export const EventTypeDuplicateInput = z.object({
|
||||
id: z.number(),
|
||||
slug: z.string(),
|
||||
title: z.string(),
|
||||
description: z.string(),
|
||||
length: z.number(),
|
||||
});
|
||||
Reference in new issue
Block a user