Remove unused '/orders/pending' route from ordersRoute.php

This route was unused and marked with a TODO for removal. Its deletion simplifies the code and eliminates unnecessary maintenance for an unused endpoint.
This commit is contained in:
Jepp9350
2025-02-06 14:28:19 +01:00
parent ad2075a7d1
commit 588c9d68ef
+1 -31
View File
@@ -47,37 +47,7 @@ class ordersRoute
$response->error('Invalid session', 400);
}
});
//TODO: Remove this route, as it is not used
$this->get('/orders/pending', function () {
// Require the user to be logged in
global $response;
$this->requirePermission('list_orders_pending');
// Get the user object
$user = (new authentication())->get_user();
// Check if the request was successful
if ($user) {
// Log the incident
(new logs_o())->add('orders', 'global', 1, $user->id, 'LIST_ORDERS_PENDING', 'Successfully listed pending orders');
// Create orders object
$orders = new orders_o();
// Return the list of orders that have not been invoiced
$response->success(
$orders->listPendingOrders(
function ($order) {
// Check if the order
/** @var array $order */
return $order;
}
)
);
} else {
// Log the incident
(new logs_o())->add('orders', 'global', 1, 0, 'LIST_ORDERS_PENDING', 'No user found, or invalid session');
// Return an error
$response->error('Invalid session', 400);
}
});
$this->post('/orders', function () {
// Require the user to be logged in