Make email and phone fields required in color requests
This commit is contained in:
@@ -265,6 +265,13 @@ app.post('/api/color-requests', async (req, res) => {
|
||||
reference_url
|
||||
} = req.body;
|
||||
|
||||
// Validate required fields
|
||||
if (!color_name || !material_type || !user_email || !user_phone) {
|
||||
return res.status(400).json({
|
||||
error: 'Color name, material type, email, and phone are required'
|
||||
});
|
||||
}
|
||||
|
||||
// Check if similar request already exists
|
||||
const existingRequest = await pool.query(
|
||||
`SELECT id, request_count FROM color_requests
|
||||
|
||||
Reference in New Issue
Block a user