🔍 Description
backend/src/middleware/validators.js validates farmerName, cropType, quantity, location. But backend/src/routes/api.js /register-batch expects batchName, location, photoUrl and then separately checks those fields manually. This mismatch means invalid requests can pass validator checks (e.g., missing batchName/photoUrl) or valid requests can be rejected depending on what the frontend send
✅ Expected Behavior
POST /api/register-batch should validate exactly the fields the handler uses:
batchName, location, photoUrl (and any additional fields required by submitBatchData/insertBatch).
Clients should receive a consistent 400 response only for missing/invalid required fields.
📷 Screenshots / 🎥 Video
No response
📄 Affected Page(s)
💻 Environment
No response
💬 Additional Info
No response
📞 Contact
Name- Aditya Mahajan
Github- Aditya8369
Email- mahajanaditya@gmail.com
🔍 Description
backend/src/middleware/validators.js validates farmerName, cropType, quantity, location. But backend/src/routes/api.js /register-batch expects batchName, location, photoUrl and then separately checks those fields manually. This mismatch means invalid requests can pass validator checks (e.g., missing batchName/photoUrl) or valid requests can be rejected depending on what the frontend send
✅ Expected Behavior
POST /api/register-batch should validate exactly the fields the handler uses:
batchName, location, photoUrl (and any additional fields required by submitBatchData/insertBatch).
Clients should receive a consistent 400 response only for missing/invalid required fields.
📷 Screenshots / 🎥 Video
No response
📄 Affected Page(s)
💻 Environment
No response
💬 Additional Info
No response
📞 Contact
Name- Aditya Mahajan
Github- Aditya8369
Email- mahajanaditya@gmail.com