feat: migrated from zod v3 to v4

This commit is contained in:
DESKTOP-RTLN3BA\$punk 2025-12-20 05:10:47 -08:00
parent ad41967d28
commit b25c1cd4b4
18 changed files with 313 additions and 271 deletions

View file

@ -6,9 +6,9 @@ import { usersTable } from "@/app/db/schema";
// Define validation schema matching the database schema
const contactSchema = z.object({
name: z.string().min(1, "Name is required").max(255, "Name is too long"),
email: z.string().email("Invalid email address").max(255, "Email is too long"),
email: z.email("Invalid email address").max(255, "Email is too long"),
company: z.string().min(1, "Company is required").max(255, "Company name is too long"),
message: z.string().optional().default(""),
message: z.string().optional().prefault(""),
});
export async function POST(request: NextRequest) {
@ -43,7 +43,7 @@ export async function POST(request: NextRequest) {
{
success: false,
message: "Validation error",
errors: error.errors,
errors: error.issues,
},
{ status: 400 }
);