Make email and phone fields required in color requests

This commit is contained in:
DaX
2025-08-29 12:44:00 +02:00
parent 6d534352b2
commit 747d15f1c3
3 changed files with 33 additions and 2 deletions

View File

@@ -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