2018-11-11 12:01:18 +01:00
|
|
|
<?php
|
2018-11-12 07:09:32 +01:00
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
use Psr\Container\ContainerInterface;
|
|
|
|
|
use Zend\Expressive\Application;
|
|
|
|
|
use Zend\Expressive\MiddlewareFactory;
|
|
|
|
|
|
2018-11-11 12:01:18 +01:00
|
|
|
/**
|
|
|
|
|
* Setup routes with a single request method:
|
|
|
|
|
*
|
2018-11-12 07:09:32 +01:00
|
|
|
* $app->get('/', App\Handler\HomePageHandler::class, 'home');
|
|
|
|
|
* $app->post('/album', App\Handler\AlbumCreateHandler::class, 'album.create');
|
|
|
|
|
* $app->put('/album/:id', App\Handler\AlbumUpdateHandler::class, 'album.put');
|
|
|
|
|
* $app->patch('/album/:id', App\Handler\AlbumUpdateHandler::class, 'album.patch');
|
|
|
|
|
* $app->delete('/album/:id', App\Handler\AlbumDeleteHandler::class, 'album.delete');
|
2018-11-11 12:01:18 +01:00
|
|
|
*
|
|
|
|
|
* Or with multiple request methods:
|
|
|
|
|
*
|
2018-11-12 07:09:32 +01:00
|
|
|
* $app->route('/contact', App\Handler\ContactHandler::class, ['GET', 'POST', ...], 'contact');
|
2018-11-11 12:01:18 +01:00
|
|
|
*
|
|
|
|
|
* Or handling all request methods:
|
|
|
|
|
*
|
2018-11-12 07:09:32 +01:00
|
|
|
* $app->route('/contact', App\Handler\ContactHandler::class)->setName('contact');
|
2018-11-11 12:01:18 +01:00
|
|
|
*
|
|
|
|
|
* or:
|
|
|
|
|
*
|
|
|
|
|
* $app->route(
|
|
|
|
|
* '/contact',
|
2018-11-12 07:09:32 +01:00
|
|
|
* App\Handler\ContactHandler::class,
|
2018-11-11 12:01:18 +01:00
|
|
|
* Zend\Expressive\Router\Route::HTTP_METHOD_ANY,
|
|
|
|
|
* 'contact'
|
|
|
|
|
* );
|
|
|
|
|
*/
|
2018-11-12 07:09:32 +01:00
|
|
|
return function (
|
|
|
|
|
Application $app,
|
|
|
|
|
MiddlewareFactory $factory,
|
|
|
|
|
ContainerInterface $container
|
|
|
|
|
) : void {
|
|
|
|
|
$app->get('/', App\Handler\PingHandler::class, 'home');
|
|
|
|
|
$app->get('/api/ping', App\Handler\PingHandler::class, 'api.ping');
|
|
|
|
|
|
|
|
|
|
$app->get('/api/maintenance/upcoming', App\Handler\MaintenanceUpcomingHandler::class, 'api.maintenance.upcoming');
|
|
|
|
|
$app->route('/api/maintenance[/{id:\w+}]', App\Handler\MaintenanceHandler::class, ['GET', 'OPTIONS'], 'api.maintenance');
|
|
|
|
|
$app->route('/api/maintenance/{id:\w+}', App\Handler\MaintenanceHandler::class, ['PUT'], 'api.maintenance.put');
|
|
|
|
|
|
|
|
|
|
// authentication and user management
|
|
|
|
|
$app->route('/api/auth/login', App\Handler\Auth\AuthHandler::class, ['POST', 'OPTIONS'], 'api.auth.login');
|
|
|
|
|
$app->route('/api/auth/renew', App\Handler\Auth\AuthHandler::class, ['GET', 'OPTIONS'], 'api.auth.renew');
|
|
|
|
|
$app->route('/api/user[/{id:\d+}]', App\Handler\User\UserHandler::class, ['GET', 'PUT', 'OPTIONS'], 'api.user.profile');
|
|
|
|
|
$app->route('/api/user/password', App\Handler\User\PasswordHandler::class, ['POST', 'OPTIONS'], 'api.user.password');
|
|
|
|
|
|
|
|
|
|
// fault management
|
|
|
|
|
$app->route('/api/fault[/{id:\d+}]', App\Handler\Fault\FaultHandler::class, ['GET', 'OPTIONS'], 'api.fault.get'); // list/show
|
|
|
|
|
$app->post('/api/fault', App\Handler\Fault\FaultHandler::class, 'api.fault.post'); // create
|
|
|
|
|
$app->put('/api/fault/{id:\d+}', App\Handler\Fault\FaultHandler::class, 'api.fault.put'); // update
|
|
|
|
|
$app->delete('/api/fault/{id:\d+}', App\Handler\Fault\FaultHandler::class, 'api.fault.delete');
|
|
|
|
|
|
|
|
|
|
$app->route('/api/fault-reject/{id:\d+}', App\Handler\Fault\FaultRejectHandler::class, ['POST', 'OPTIONS'], 'api.fault-reject.post');
|
|
|
|
|
$app->route('/api/fault-comment/{id:\d+}', App\Handler\Fault\FaultCommentHandler::class, ['POST', 'OPTIONS'], 'api.fault-comment.post');
|
|
|
|
|
$app->route('/api/fault-attachment/{id:\d+}/{type}', App\Handler\Fault\FaultAttachmentHandler::class, ['POST', 'OPTIONS'], 'api.fault-attachment.post');
|
|
|
|
|
$app->route('/show-attachment/{id:\d+}', App\Handler\Fault\FaultAttachmentHandler::class, ['GET', 'OPTIONS'], 'show-attachment');
|
|
|
|
|
|
|
|
|
|
$app->route('/hibajegy-pdf/{id:\d+}[/{filename}]', App\Handler\Pdf\GenerateWorksheetHandler::class, ['GET', 'OPTIONS'], 'hibajegy-pdf');
|
|
|
|
|
$app->route('/karbantartasjegy-pdf/{id:\w+}[/{filename}]', App\Handler\Pdf\GenerateMaintenanceSheetHandler::class, ['GET', 'OPTIONS'], 'karbantartasjegy-pdf');
|
2018-11-11 12:01:18 +01:00
|
|
|
|
2018-11-12 07:09:32 +01:00
|
|
|
// core data
|
|
|
|
|
$app->route('/api/error-category', App\Handler\ErrorCategoryHandler::class, ['GET', 'OPTIONS'], 'api.error-category.get'); // list/show
|
|
|
|
|
$app->route('/api/error-origin', App\Handler\ErrorOriginHandler::class, ['GET', 'OPTIONS'], 'api.error-origin.get'); // list/show
|
|
|
|
|
$app->route('/api/facility-location', App\Handler\FacilityLocationHandler::class, ['GET', 'OPTIONS'], 'api.facility-location.get'); // list/show
|
|
|
|
|
$app->route('/api/solution-time-interval', App\Handler\SolutionTimeIntervalHandler::class, ['GET', 'OPTIONS'], 'api.solution-time-interval.get'); // list/show
|
|
|
|
|
};
|