From b3fab3aacd1e458f6f24abc4cb08a688005f463b Mon Sep 17 00:00:00 2001 From: Morgan <33722304+ThyMinimalDev@users.noreply.github.com> Date: Sat, 18 May 2024 00:22:19 +0300 Subject: [PATCH] chore: api-v2 slotInterval, afterEventBuffer, beforeEventBuffer min 0 (#15039) --- .../v2/src/ee/event-types/inputs/create-event-type.input.ts | 3 +++ .../v2/src/ee/event-types/inputs/update-event-type.input.ts | 3 +++ packages/prisma/zod/custom/eventtype.ts | 6 +++--- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/apps/api/v2/src/ee/event-types/inputs/create-event-type.input.ts b/apps/api/v2/src/ee/event-types/inputs/create-event-type.input.ts index abe32ba803..ca9ceb04db 100644 --- a/apps/api/v2/src/ee/event-types/inputs/create-event-type.input.ts +++ b/apps/api/v2/src/ee/event-types/inputs/create-event-type.input.ts @@ -55,6 +55,7 @@ export class CreateEventTypeInput { disableGuests?: boolean; @IsInt() + @Min(0) @IsOptional() slotInterval?: number; @@ -64,10 +65,12 @@ export class CreateEventTypeInput { minimumBookingNotice?: number; @IsInt() + @Min(0) @IsOptional() beforeEventBuffer?: number; @IsInt() + @Min(0) @IsOptional() afterEventBuffer?: number; diff --git a/apps/api/v2/src/ee/event-types/inputs/update-event-type.input.ts b/apps/api/v2/src/ee/event-types/inputs/update-event-type.input.ts index 2ea125960d..8b3d901707 100644 --- a/apps/api/v2/src/ee/event-types/inputs/update-event-type.input.ts +++ b/apps/api/v2/src/ee/event-types/inputs/update-event-type.input.ts @@ -336,10 +336,12 @@ export class UpdateEventTypeInput { minimumBookingNotice?: number; @IsInt() + @Min(0) @IsOptional() beforeEventBuffer?: number; @IsInt() + @Min(0) @IsOptional() afterEventBuffer?: number; @@ -376,6 +378,7 @@ export class UpdateEventTypeInput { // currency?: string; @IsInt() + @Min(0) @IsOptional() slotInterval?: number; diff --git a/packages/prisma/zod/custom/eventtype.ts b/packages/prisma/zod/custom/eventtype.ts index 218edfb41f..26670450f0 100755 --- a/packages/prisma/zod/custom/eventtype.ts +++ b/packages/prisma/zod/custom/eventtype.ts @@ -15,10 +15,10 @@ export const createEventTypeInput = z.object({ locations: imports.eventTypeLocations, metadata: imports.EventTypeMetaDataSchema.optional(), disableGuests: z.boolean().optional(), - slotInterval: z.number().nullish(), + slotInterval: z.number().min(0).nullish(), minimumBookingNotice: z.number().int().min(0).optional(), - beforeEventBuffer: z.number().int().optional(), - afterEventBuffer: z.number().int().optional(), + beforeEventBuffer: z.number().int().min(0).optional(), + afterEventBuffer: z.number().int().min(0).optional(), }) .partial({ hidden: true, locations: true }) .refine((data) => (data.teamId ? data.teamId && data.schedulingType : true), {