This repository has been archived on 2026-01-31. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
nextjs-auth0/utils/types.ts
2024-07-07 22:52:00 +02:00

32 lines
843 B
TypeScript

import { z } from 'zod';
export const UserSchema = z.object({
id: z.string(),
name: z.string(),
email: z.string().email(),
deleted: z.boolean(),
createdAt: z.string().transform(arg => new Date(arg)),
updatedAt: z.string().transform(arg => new Date(arg))
});
export type User = z.infer<typeof UserSchema>;
export const CustomerFormCreateSchema = z.object({
type: z.string(),
text: z.string()
});
export type CustomerFormCreate = z.infer<typeof CustomerFormCreateSchema>;
export const CustomerFormSchema = z.object({
id: z.string(),
type: z.string(),
text: z.string(),
createdAt: z.string().transform(arg => new Date(arg)),
updatedAt: z.string().transform(arg => new Date(arg))
});
export const CustomerFormListSchema = z.array(CustomerFormSchema);
export type CustomerForm = z.infer<typeof CustomerFormSchema>;