mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-28 02:23:53 +02:00
feat: migrated from zod v3 to v4
This commit is contained in:
parent
ad41967d28
commit
b25c1cd4b4
18 changed files with 313 additions and 271 deletions
|
|
@ -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 }
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue