Cleaned up

This commit is contained in:
Jepp9350
2024-12-20 12:20:42 +01:00
parent 5d39c0943f
commit e748b7af75
+4 -2
View File
@@ -3,6 +3,7 @@
namespace routes;
use classes\authentication;
use classes\response;
use objects\bookings_o;
use objects\logs_o;
use traits\route_t;
@@ -16,7 +17,8 @@ class bookingsRoute
/** All bookings */
$this->get('/bookings', function () {
// Require the user to be logged in
global $response;
global /** @var response $response */
$response;
$this->requirePermission('list_bookings');
// Get the user object
$user = (new authentication())->get_user();
@@ -24,7 +26,7 @@ class bookingsRoute
if ($user) {
// Log the incident
(new logs_o())->add('bookings', 'global', 1, $user->id, 'LIST_BOOKINGS', 'Successfully listed bookings');
// Return the list of departments
// Return the list of bookings
$response->success(
(new bookings_o())->listObjectsWithPaginationIfSet()
);