mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-11 17:27:31 +02:00
Fix client order validation errors for production
Update Zod schemas and frontend form handling to correctly coerce string inputs to numbers for fields like supplierId and deposit, resolving server-side validation errors and improving data integrity. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b163d4c0-de5e-4f4e-a9c0-aed4c7049718 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/b163d4c0-de5e-4f4e-a9c0-aed4c7049718/W2tfZav
This commit is contained in:
1 parent
632eb8dd82
commit
4abe7f8cd1
5 files changed
+62
-108
No files matched your search
+5
-5
@@ -456,17 +456,17 @@ export const insertCustomerOrderFrontendSchema = z.object({
|
||||
contactNumber: z.string().min(1, "Contact number is required"), // Maps to customerPhone
|
||||
productName: z.string().min(1, "Product name is required"), // Maps to productDesignation
|
||||
productDescription: z.string().optional(), // Optional description
|
||||
quantity: z.number().int().positive().default(1),
|
||||
groupId: z.number().int().positive(),
|
||||
quantity: z.coerce.number().int().positive().default(1),
|
||||
groupId: z.coerce.number().int().positive(),
|
||||
isPickup: z.boolean().default(false),
|
||||
notes: z.string().optional(),
|
||||
// Optional fields with defaults
|
||||
orderTaker: z.string().optional(), // Will be set to creator name if not provided
|
||||
gencode: z.string().optional().default(""), // Will be empty if not provided
|
||||
supplierId: z.number().int().positive().optional().default(1), // Default supplier ID
|
||||
deposit: z.number().optional().default(0),
|
||||
supplierId: z.coerce.number().int().positive().optional().default(1), // Default supplier ID
|
||||
deposit: z.coerce.number().optional().default(0),
|
||||
isPromotionalPrice: z.boolean().default(false),
|
||||
customerEmail: z.string().email().optional(),
|
||||
customerEmail: z.string().email().optional().or(z.literal("")),
|
||||
productReference: z.string().optional(),
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user