Delete bag movements for an employee

This endpoint allows the deletion of bag movements associated with an employee within a specified time period.

DELETE /api/v1/businesses/{businessId}/bags/{bagId}/employees/{employeeId}/movements?from={yyyy-MM-dd}&to={yyyy-MM-dd}

If the data included in the request is correct, all movements for that employee, for the specified bag, within the time period provided in the URL will be deleted.

Here is an example:

DELETE /api/v1/businesses/BUSINESSID/bags/DT/employees/1006357/movements?from=2024-09-22&to=2024-09-26

The response of this request will contain all the movements found and the status of each of them:

[
    {
        "status": "DELETE",
        "employeeId": "1006357",
        "destinationBagId": "DT",
        "destinationDate": "2024-09-23",
        "value": 1.0,
        "reason": "Data adjustment 23"
    },
    {
        "status": "DELETE",
        "employeeId": "1006357",
        "destinationBagId": "DT",
        "destinationDate": "2024-09-24",
        "value": 2.0,
        "reason": "Data adjustment 24"
    },
    {
        "status": "DELETE",
        "employeeId": "1006357",
        "destinationBagId": "DT",
        "destinationDate": "2024-09-25",
        "value": 1.0,
        "reason": "Data adjustment 25"
    }
]

In this example, the status field in each movement indicates whether it has been deleted: DELETE. If any of the movements causes an error during deletion, the status field for that movement will show ERROR, and an additional cause field will indicate the reason for the error.

Considerations

The request removes all movements linked to the bag specified in the parameters: both movements where the bag is the origin and those where it is the destination.

If there are no movements to delete within the specified time period in the URL, the request will return a 404 Not Found error, indicating Not Movements to Delete […​].

If the employee ID or bag ID is incorrect, the request will return a 404 Not Found error.

If any of the movements causes an error during deletion, the request will return a 409 Conflict error.

What is a bag?