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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user