Project

General

Profile

Bug #83

Updated by Vivek Kumar 6 days ago

The product creation API incorrectly validates the category field when multiple category IDs are provided as a comma-separated string in a multipart/form-data request. 
 Although each individual value appears to be a valid MongoDB ObjectId, the backend rejects the request with the error:`{"success":false,"message":"Category must be a valid ID"}` 

 **Endpoint:** 
 `https://api.akinderwellness.com:4001/api/products/add` 

 **Steps to Reproduce** 
 1. Craft a request to the product creation endpoint (multipart/form-data). 
 2. Provide multiple category IDs in the category field as a comma-separated string: 
 3. category = 69c10cfb7a5370455e2f83bc,69c10cbd7a5370455e2f83ae,69901934d6ca9152e44df413 
 4. Send the request. 

 **Observed Result** 
 The API responds with:{"success":false,"message":"Category must be a valid ID"} 
 Even though all provided values are valid MongoDB ObjectIds. 

 **Expected Result** 

 The API should correctly handle multiple category IDs.

Back