Tweak/gitignore prisma zod (#1905)

* Extracts ignored createEventTypeBaseInput

* Adds postinstall script
This commit is contained in:
Omar López authored and GitHub committed 2022-02-17 17:25:19 -07:00
1 parent 0bf3818b30
commit 15bfeb30d7
4 files changed
+23 -1

No files matched your search

+18
View File
@@ -2,6 +2,8 @@ import { z } from "zod";
import { LocationType } from "@calcom/lib/location";
import { _EventTypeModel } from "./zod/eventtype";
export const eventTypeLocations = z.array(
z.object({ type: z.nativeEnum(LocationType), address: z.string().optional() })
);
@@ -9,3 +11,19 @@ export const eventTypeLocations = z.array(
export const eventTypeSlug = z.string().transform((val) => val.trim());
export const stringToDate = z.string().transform((a) => new Date(a));
export const stringOrNumber = z.union([z.string().transform((v) => parseInt(v, 10)), z.number().int()]);
const createEventTypeBaseInput = _EventTypeModel
.pick({
title: true,
slug: true,
description: true,
length: true,
teamId: true,
schedulingType: true,
})
.refine((data) => (data.teamId ? data.teamId && data.schedulingType : true), {
path: ["schedulingType"],
message: "You must select a scheduling type for team events",
});
export const createEventTypeInput = createEventTypeBaseInput;