Title:
POST /api/v1/settings/marketing/events/mass-destroy Returns 200 Even When IDs Do Not Exist
Description:
The mass-destroy endpoint accepts an array of marketing event IDs to delete. However, if the given IDs do not exist, the API still returns a success response (200 OK) with the message:
"Marketing event deleted successfully."
This is misleading and should be handled with validation or a partial success message.
Affected Endpoint:
POST /api/v1/settings/marketing/events/mass-destroy
Preconditions:
- Krayin REST API is running.
- No event with ID
3 exists in the system (as shown in test).
Steps to Reproduce:
- Send a request to:
curl -X POST 'http://<host>/api/v1/settings/marketing/events/mass-destroy' \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-d '{"indices": [3]}'
- Ensure ID 3 does not exist in the DB.
- Observe the response.
Actual Result:
{
"data": {
"message": "Marketing event deleted successfully."
}
}
Expected Result:
- Return a 422 Unprocessable Entity or a multi-status 207 response:
{
"message": "Some records could not be deleted because they do not exist.",
"deleted": [],
"not_found": [3]
}
Suggested Fix:
- Add validation to check if each ID exists before attempting delete.
- Return proper status and feedback to indicate what was and wasn’t deleted.
Benefit:
- Accurate response for better user experience and automation.
- Prevents assumptions that non-existent records were removed.
Title:
POST /api/v1/settings/marketing/events/mass-destroyReturns 200 Even When IDs Do Not ExistDescription:
The
mass-destroyendpoint accepts an array of marketing event IDs to delete. However, if the given IDs do not exist, the API still returns a success response (200 OK) with the message:"Marketing event deleted successfully."This is misleading and should be handled with validation or a partial success message.
Affected Endpoint:
POST /api/v1/settings/marketing/events/mass-destroyPreconditions:
3exists in the system (as shown in test).Steps to Reproduce:
Actual Result:
{ "data": { "message": "Marketing event deleted successfully." } }Expected Result:
{ "message": "Some records could not be deleted because they do not exist.", "deleted": [], "not_found": [3] }Suggested Fix:
Benefit: