Skip to content

POST /api/v1/settings/marketing/campaigns/mass-destroy returns misleading success message for non-existent IDs #159

Description

@sagarkumar-webkul

Title:

POST /api/v1/settings/marketing/campaigns/mass-destroy returns misleading success message for non-existent IDs

Description:

When attempting to delete campaign IDs that no longer exist (i.e., already deleted), the API still returns a 200 OK response with the message:
"Marketing campaigns deleted successfully."
This is misleading, as no actual deletion occurs when the provided IDs are not valid or present in the database.

Affected Endpoint:

  • POST /api/v1/settings/marketing/campaigns/mass-destroy

Preconditions:

  • Campaign with ID 1 was deleted earlier and does not exist in the system.

Steps to Reproduce:

  1. Send a request to delete a non-existent campaign:
curl -X 'POST' \
  'http://<host>/api/v1/settings/marketing/campaigns/mass-destroy' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer <token>' \
  -H 'Content-Type: application/json' \
  -d '{
    "indices": [1]
}'
  1. Observe the API response.

Actual Result:

Image
{
  "data": {
    "message": "Marketing campaigns deleted successfully."
  }
}

Expected Result:

A response indicating that no campaigns were deleted, such as:

{
  "data": {
    "message": "No campaigns found for deletion."
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions