Tweak/gitignore prisma zod (#1905)

* Extracts ignored createEventTypeBaseInput

* Adds postinstall script
This commit is contained in:
Omar López 2022-02-17 17:25:19 -07:00 committed by zomars
parent bab6fcc4ed
commit 487a4153e4
4 changed files with 23 additions and 1 deletions

View File

@ -8,7 +8,7 @@ import {
_EventTypeModel,
} from "@calcom/prisma/zod";
import { stringOrNumber } from "@calcom/prisma/zod-utils";
import { createEventTypeInput } from "@calcom/prisma/zod/eventtypeCustom";
import { createEventTypeInput } from "@calcom/prisma/zod-utils";
import { createProtectedRouter } from "@server/createRouter";
import { viewerRouter } from "@server/routers/viewer";

View File

@ -24,6 +24,7 @@
"lint": "turbo run lint",
"pre-commit": "lint-staged",
"prepare": "husky install",
"postinstall": "yarn workspace @calcom/prisma generate-schemas",
"start": "turbo run start --scope=\"@calcom/web\"",
"test": "turbo run test",
"test-playwright": "yarn playwright test",

View File

@ -3,6 +3,8 @@ import { z } from "zod";
import { LocationType } from "@calcom/lib/location";
import { slugify } from "@calcom/lib/slugify";
import { _EventTypeModel } from "./zod/eventtype";
export const eventTypeLocations = z.array(
z.object({ type: z.nativeEnum(LocationType), address: z.string().optional() })
);
@ -10,3 +12,19 @@ export const eventTypeLocations = z.array(
export const eventTypeSlug = z.string().transform((val) => slugify(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;

View File

@ -54,6 +54,9 @@
],
"outputs": [".next/**"]
},
"@calcom/web#dev": {
"dependsOn": ["@calcom/prisma#build"]
},
"@calcom/web#dx": {
"dependsOn": ["@calcom/prisma#dx"]
},