feat: add read and delete customer form

This commit is contained in:
Riccardo
2024-07-07 23:53:22 +02:00
parent be05e065b8
commit 71daa9aa7d
4 changed files with 65 additions and 33 deletions

View File

@@ -0,0 +1,5 @@
import { NextResponse } from 'next/server';
export function createErrorResponse(message: string, status: number) {
return NextResponse.json({ success: false, message }, { status });
}

View File

@@ -1,16 +1,5 @@
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()
@@ -29,3 +18,9 @@ export const CustomerFormSchema = z.object({
export const CustomerFormListSchema = z.array(CustomerFormSchema);
export type CustomerForm = z.infer<typeof CustomerFormSchema>;
export const ContextSchema = z.object({
params: z.object({
id: z.string()
})
});