Skip to content

Proper Handling of Already Inactive Obligation Classifications #129

@Vaibhavsahu2810

Description

@Vaibhavsahu2810

Description

Currently, when attempting to delete an already inactive obligation classification, the DeleteObligationClassification function simply returns an empty 200 OK response. This behavior does not provide clear feedback to the user, leading to confusion as to whether any action was taken.

Instead, the API should return a meaningful JSON response indicating that the classification was already inactive and no action was needed.

Steps to Reproduce:

  1. Ensure that an obligation classification exists in the database and is marked as inactive (Active = false).

  2. Run the following cURL command to send a DELETE request:

    curl -X 'DELETE' \
      'http://localhost:8080/api/v1/obligations/classifications/GREEN' \
      -H 'accept: application/json' \
      -H 'Authorization: Bearer token'
  3. Observe the response:

    • Current behavior: The API returns an empty 200 OK response.

    After fix behavior: The API should return a JSON response like:

    {
      "status": 200,
      "message": "Obligation classification 'GREEN' is already inactive",
      "error": "no action needed",
      "path": "/api/v1/obligations/classifications/GREEN",
      "timestamp": "2025-03-25T12:00:00Z"
    }

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