Files
api/services/nginx/app/routes/moduleXLVaskRoute.php
T
Jepp9350 d00bfef583 Add 'product' support to department time bookings
This update incorporates the 'product' parameter into the department time bookings API, supporting its addition, update, and validation processes. Additionally, composer dependencies are updated with several new libraries, enhancing functionality and compatibility.
2025-05-19 15:16:58 +02:00

120 lines
3.9 KiB
PHP

<?php
namespace routes;
use classes\authentication;
use classes\response;
use classes\router;
use classes\xlvask;
use traits\route_t;
class moduleXLVaskRoute
{
use route_t;
public function run(): void
{
global /** @var response $response */
/** @var router $router */
$router, $response;
$this->get('/modules/xlvask/usageLog', function () {
global $response;
self::requirePermission('modules_xlvask_usageLog');
$params = [
'dateFrom' => null,
'regNr' => null,
'vehicleId' => null,
'customerId' => null,
];
// Get the parameters from the request
foreach ( $params as $key => $value ) {
if ($this->isParametersSet([$key])) {
$params[$key] = $this->getParameter($key);
}
}
// Create the xlvask object
$xlvask = new xlvask();
$result = $xlvask->getUsageLog(...$params);
// Response
$response->success($result, 200);
},
[
'modules_xlvask_usageLog' => 'Get the usage log of the xlvask module'
]
);
$this->get('/modules/xlvask/vehicles', function () {
global $response;
self::requirePermission('modules_xlvask_vehicles');
$params = [
'customerId' => null,
'vehicleId' => null,
'registrationNumber' => null,
'changeDate' => null,
];
// Get the parameters from the request
foreach ( $params as $key => $value ) {
if ($this->isParametersSet([$key])) {
$params[$key] = $this->getParameter($key);
}
}
// Create the xlvask object
$xlvask = new xlvask();
$result = $xlvask->getVehicles(...$params);
// Response
$response->success($result, 200);
},
[
'modules_xlvask_vehicles' => 'Get the vehicles of the xlvask module'
]
);
$this->get('/modules/xlvask/customers', function () {
global $response;
self::requirePermission('modules_xlvask_customers');
$params = [
'customerId' => null,
'customerName' => null,
'customerExternalId' => null,
'vatNumber' => null,
'changeDate' => null,
'users' => null,
];
// Get the parameters from the request
foreach ( $params as $key => $value ) {
if ($this->isParametersSet([$key])) {
$params[$key] = $this->getParameter($key);
}
}
// Create the xlvask object
$xlvask = new xlvask();
$result = $xlvask->getCustomers(...$params);
// Response
$response->success($result, 200);
},
[
'modules_xlvask_customers' => 'Get the customers of the xlvask module'
]
);
$this->get('/modules/xlvask/internal/vehicle-types', function () {
global $response;
self::requirePermission('modules_xlvask_internal_vehicle_types');
$user = (new authentication())->get_user();
$xlvask_vehicle_types = new \objects\xlvask_vehicle_types_o();
$result = $xlvask_vehicle_types->listObjectsWithPaginationIfSet(
function ($tmp_object_array) {
return [
...$tmp_object_array
];
}
);
// Response
$response->success($result, 200);
},
[
'modules_xlvask_internal_vehicle_types' => 'Get the vehicle types of the xlvask module'
]
);
}
}