fix: added slugify the eventType slugs on the api aswell (#10007)

pull/10143/head^2
Pradumn Kumar 2023-07-13 23:03:26 +05:30 committed by GitHub
parent c23a2102f4
commit 4de1de3418
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -1,5 +1,6 @@
import { z } from "zod";
import slugify from "@calcom/lib/slugify";
import { _EventTypeModel as EventType, _HostModel } from "@calcom/prisma/zod";
import { customInputSchema, eventTypeBookingFields } from "@calcom/prisma/zod-utils";
@ -58,7 +59,7 @@ export const schemaEventTypeBaseBodyParams = EventType.pick({
const schemaEventTypeCreateParams = z
.object({
title: z.string(),
slug: z.string(),
slug: z.string().transform((s) => slugify(s)),
description: z.string().optional().nullable(),
length: z.number().int(),
metadata: z.any().optional(),
@ -76,7 +77,10 @@ export const schemaEventTypeCreateBodyParams = schemaEventTypeBaseBodyParams
const schemaEventTypeEditParams = z
.object({
title: z.string().optional(),
slug: z.string().optional(),
slug: z
.string()
.transform((s) => slugify(s))
.optional(),
length: z.number().int().optional(),
seatsPerTimeSlot: z.number().optional(),
seatsShowAttendees: z.boolean().optional(),