Tweak/gitignore prisma zod (#1905)
* Extracts ignored createEventTypeBaseInput * Adds postinstall script
This commit is contained in:
parent
0bf3818b30
commit
15bfeb30d7
4 changed files with 23 additions and 1 deletions
|
@ -8,7 +8,7 @@ import {
|
||||||
_EventTypeModel,
|
_EventTypeModel,
|
||||||
} from "@calcom/prisma/zod";
|
} from "@calcom/prisma/zod";
|
||||||
import { stringOrNumber } from "@calcom/prisma/zod-utils";
|
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 { createProtectedRouter } from "@server/createRouter";
|
||||||
import { viewerRouter } from "@server/routers/viewer";
|
import { viewerRouter } from "@server/routers/viewer";
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
"lint": "turbo run lint",
|
"lint": "turbo run lint",
|
||||||
"pre-commit": "lint-staged",
|
"pre-commit": "lint-staged",
|
||||||
"prepare": "husky install",
|
"prepare": "husky install",
|
||||||
|
"postinstall": "yarn workspace @calcom/prisma generate-schemas",
|
||||||
"start": "turbo run start --scope=\"@calcom/web\"",
|
"start": "turbo run start --scope=\"@calcom/web\"",
|
||||||
"test": "turbo run test",
|
"test": "turbo run test",
|
||||||
"test-playwright": "yarn playwright test",
|
"test-playwright": "yarn playwright test",
|
||||||
|
|
|
@ -2,6 +2,8 @@ import { z } from "zod";
|
||||||
|
|
||||||
import { LocationType } from "@calcom/lib/location";
|
import { LocationType } from "@calcom/lib/location";
|
||||||
|
|
||||||
|
import { _EventTypeModel } from "./zod/eventtype";
|
||||||
|
|
||||||
export const eventTypeLocations = z.array(
|
export const eventTypeLocations = z.array(
|
||||||
z.object({ type: z.nativeEnum(LocationType), address: z.string().optional() })
|
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 eventTypeSlug = z.string().transform((val) => val.trim());
|
||||||
export const stringToDate = z.string().transform((a) => new Date(a));
|
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()]);
|
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;
|
||||||
|
|
|
@ -51,6 +51,9 @@
|
||||||
],
|
],
|
||||||
"outputs": [".next/**"]
|
"outputs": [".next/**"]
|
||||||
},
|
},
|
||||||
|
"@calcom/web#dev": {
|
||||||
|
"dependsOn": ["@calcom/prisma#build"]
|
||||||
|
},
|
||||||
"@calcom/web#dx": {
|
"@calcom/web#dx": {
|
||||||
"dependsOn": ["@calcom/prisma#dx"]
|
"dependsOn": ["@calcom/prisma#dx"]
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue