cal.pub0.org/lib/validations/user.ts

30 lines
640 B
TypeScript
Raw Normal View History

import { withValidation } from "next-validations";
2022-03-30 12:17:55 +00:00
import { _UserModel as User } from "@calcom/prisma/zod";
2022-03-30 12:17:55 +00:00
export const schemaUserBodyParams = User.omit({
id: true,
createdAt: true,
password: true,
twoFactorEnabled: true,
twoFactorSecret: true,
}).partial();
2022-03-30 12:17:55 +00:00
export const schemaUserPublic = User.omit({
identityProvider: true,
identityProviderId: true,
plan: true,
metadata: true,
password: true,
twoFactorEnabled: true,
twoFactorSecret: true,
trialEndsAt: true,
completedOnboarding: true,
});
export const withValidUser = withValidation({
schema: schemaUserBodyParams,
type: "Zod",
mode: "body",
});