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

30 lines
630 B
TypeScript

import { withValidation } from "next-validations";
import { _UserModel as User } from "@calcom/prisma/zod";
export const schemaUserBodyParams = User.omit({
id: true,
createdAt: true,
password: true,
twoFactorEnabled: true,
twoFactorSecret: true,
});
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",
});