cal.pub0.org/packages/trpc/server/routers/viewer/teams/inviteMember.schema.ts

20 lines
650 B
TypeScript

import { z } from "zod";
import { MembershipRole } from "@calcom/prisma/enums";
export const ZInviteMemberInputSchema = z.object({
teamId: z.number(),
usernameOrEmail: z.union([z.string(), z.array(z.string())]).transform((usernameOrEmail) => {
if (typeof usernameOrEmail === "string") {
return usernameOrEmail.trim().toLowerCase();
}
return usernameOrEmail.map((item) => item.trim().toLowerCase());
}),
role: z.nativeEnum(MembershipRole),
language: z.string(),
sendEmailInvitation: z.boolean(),
isOrg: z.boolean().default(false),
});
export type TInviteMemberInputSchema = z.infer<typeof ZInviteMemberInputSchema>;