2018-08-25 21:16:20 +02:00
|
|
|
<?php
|
|
|
|
|
2023-02-03 20:41:59 +01:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2018-08-25 21:16:20 +02:00
|
|
|
use FastRoute\RouteCollector;
|
|
|
|
|
|
|
|
/** @var RouteCollector $route */
|
|
|
|
|
2018-12-18 02:23:44 +01:00
|
|
|
// Pages
|
2019-06-13 15:18:47 +02:00
|
|
|
$route->get('/', 'HomeController@index');
|
2023-11-12 17:40:21 +01:00
|
|
|
$route->get('/register', 'RegistrationController@view');
|
|
|
|
$route->post('/register', 'RegistrationController@save');
|
2018-09-02 02:13:18 +02:00
|
|
|
$route->get('/credits', 'CreditsController@index');
|
2020-09-01 00:27:29 +02:00
|
|
|
$route->get('/health', 'HealthController@index');
|
2018-12-18 02:23:44 +01:00
|
|
|
|
2018-10-25 18:53:05 +02:00
|
|
|
// Authentication
|
2018-11-27 12:01:36 +01:00
|
|
|
$route->get('/login', 'AuthController@login');
|
|
|
|
$route->post('/login', 'AuthController@postLogin');
|
2018-10-25 18:53:05 +02:00
|
|
|
$route->get('/logout', 'AuthController@logout');
|
|
|
|
|
2020-11-15 18:47:30 +01:00
|
|
|
// OAuth
|
2022-12-11 18:01:34 +01:00
|
|
|
$route->addGroup(
|
|
|
|
'/oauth/{provider}',
|
2022-12-14 19:15:20 +01:00
|
|
|
function (RouteCollector $route): void {
|
2022-12-11 18:01:34 +01:00
|
|
|
$route->get('', 'OAuthController@index');
|
|
|
|
$route->post('/connect', 'OAuthController@connect');
|
|
|
|
$route->post('/disconnect', 'OAuthController@disconnect');
|
|
|
|
}
|
|
|
|
);
|
2020-11-15 18:47:30 +01:00
|
|
|
|
|
|
|
// User settings
|
2022-12-11 18:01:34 +01:00
|
|
|
$route->addGroup(
|
|
|
|
'/settings',
|
2022-12-14 19:15:20 +01:00
|
|
|
function (RouteCollector $route): void {
|
2022-12-11 18:01:34 +01:00
|
|
|
$route->get('/profile', 'SettingsController@profile');
|
|
|
|
$route->post('/profile', 'SettingsController@saveProfile');
|
|
|
|
$route->get('/password', 'SettingsController@password');
|
|
|
|
$route->post('/password', 'SettingsController@savePassword');
|
|
|
|
$route->get('/theme', 'SettingsController@theme');
|
|
|
|
$route->post('/theme', 'SettingsController@saveTheme');
|
|
|
|
$route->get('/language', 'SettingsController@language');
|
|
|
|
$route->post('/language', 'SettingsController@saveLanguage');
|
2023-11-11 21:26:11 +01:00
|
|
|
$route->get('/certificates', 'SettingsController@certificate');
|
|
|
|
$route->post('/certificates/ifsg', 'SettingsController@saveIfsgCertificate');
|
|
|
|
$route->post('/certificates/driving', 'SettingsController@saveDrivingLicense');
|
2022-12-11 18:01:34 +01:00
|
|
|
$route->get('/oauth', 'SettingsController@oauth');
|
2023-09-17 20:15:49 +02:00
|
|
|
$route->get('/sessions', 'SettingsController@sessions');
|
|
|
|
$route->post('/sessions', 'SettingsController@sessionsDelete');
|
2022-12-11 18:01:34 +01:00
|
|
|
}
|
|
|
|
);
|
2020-11-15 18:47:30 +01:00
|
|
|
|
2019-10-08 16:17:06 +02:00
|
|
|
// Password recovery
|
2022-12-11 18:01:34 +01:00
|
|
|
$route->addGroup(
|
|
|
|
'/password/reset',
|
2022-12-14 19:15:20 +01:00
|
|
|
function (RouteCollector $route): void {
|
2022-12-11 18:01:34 +01:00
|
|
|
$route->get('', 'PasswordResetController@reset');
|
|
|
|
$route->post('', 'PasswordResetController@postReset');
|
|
|
|
$route->get('/{token:.+}', 'PasswordResetController@resetPassword');
|
|
|
|
$route->post('/{token:.+}', 'PasswordResetController@postResetPassword');
|
|
|
|
}
|
|
|
|
);
|
2019-10-08 16:17:06 +02:00
|
|
|
|
2018-12-18 02:23:44 +01:00
|
|
|
// Stats
|
|
|
|
$route->get('/metrics', 'Metrics\\Controller@metrics');
|
|
|
|
$route->get('/stats', 'Metrics\\Controller@stats');
|
2018-11-20 18:55:56 +01:00
|
|
|
|
2023-02-13 19:28:10 +01:00
|
|
|
// Angeltypes
|
|
|
|
$route->addGroup('/angeltypes', function (RouteCollector $route): void {
|
|
|
|
$route->get('/about', 'AngelTypesController@about');
|
|
|
|
});
|
|
|
|
|
2020-04-05 16:54:45 +02:00
|
|
|
// News
|
|
|
|
$route->get('/meetings', 'NewsController@meetings');
|
2022-12-11 18:01:34 +01:00
|
|
|
$route->addGroup(
|
|
|
|
'/news',
|
2022-12-14 19:15:20 +01:00
|
|
|
function (RouteCollector $route): void {
|
2022-12-11 18:01:34 +01:00
|
|
|
$route->get('', 'NewsController@index');
|
|
|
|
$route->get('/{news_id:\d+}', 'NewsController@show');
|
|
|
|
$route->post('/{news_id:\d+}', 'NewsController@comment');
|
|
|
|
$route->post('/comment/{comment_id:\d+}', 'NewsController@deleteComment');
|
|
|
|
}
|
|
|
|
);
|
2020-04-05 16:54:45 +02:00
|
|
|
|
2020-12-06 00:16:15 +01:00
|
|
|
// FAQ
|
|
|
|
$route->get('/faq', 'FaqController@index');
|
|
|
|
|
2020-12-18 18:27:10 +01:00
|
|
|
// Questions
|
2022-12-11 18:01:34 +01:00
|
|
|
$route->addGroup(
|
|
|
|
'/questions',
|
2022-12-14 19:15:20 +01:00
|
|
|
function (RouteCollector $route): void {
|
2022-12-11 18:01:34 +01:00
|
|
|
$route->get('', 'QuestionsController@index');
|
|
|
|
$route->post('', 'QuestionsController@delete');
|
|
|
|
$route->get('/new', 'QuestionsController@add');
|
|
|
|
$route->post('/new', 'QuestionsController@save');
|
|
|
|
}
|
|
|
|
);
|
2020-12-18 18:27:10 +01:00
|
|
|
|
2022-04-09 19:08:53 +02:00
|
|
|
// Messages
|
2022-12-11 18:01:34 +01:00
|
|
|
$route->addGroup(
|
|
|
|
'/messages',
|
2022-12-14 19:15:20 +01:00
|
|
|
function (RouteCollector $route): void {
|
2022-12-11 18:01:34 +01:00
|
|
|
$route->get('', 'MessagesController@index');
|
|
|
|
$route->post('', 'MessagesController@redirectToConversation');
|
|
|
|
$route->get('/{user_id:\d+}', 'MessagesController@messagesOfConversation');
|
|
|
|
$route->post('/{user_id:\d+}', 'MessagesController@send');
|
|
|
|
$route->post('/{user_id:\d+}/{msg_id:\d+}', 'MessagesController@delete');
|
|
|
|
}
|
|
|
|
);
|
2022-04-09 19:08:53 +02:00
|
|
|
|
2018-11-20 18:55:56 +01:00
|
|
|
// API
|
2023-05-21 12:40:36 +02:00
|
|
|
$route->addGroup(
|
|
|
|
'/api',
|
|
|
|
function (RouteCollector $route): void {
|
2023-07-22 20:35:45 +02:00
|
|
|
$route->get('', 'Api\IndexController@index');
|
2023-05-21 12:40:36 +02:00
|
|
|
|
|
|
|
$route->addGroup(
|
|
|
|
'/v0-beta',
|
|
|
|
function (RouteCollector $route): void {
|
2023-07-22 20:35:45 +02:00
|
|
|
$route->addRoute(['OPTIONS'], '[/{resource:.+}]', 'Api\IndexController@options');
|
|
|
|
$route->get('', 'Api\IndexController@indexV0');
|
2023-05-21 12:40:36 +02:00
|
|
|
|
2023-07-23 13:52:33 +02:00
|
|
|
$route->get('/angeltypes', 'Api\AngelTypeController@index');
|
2023-07-22 20:35:45 +02:00
|
|
|
$route->get('/news', 'Api\NewsController@index');
|
2023-11-03 19:03:31 +01:00
|
|
|
$route->get('/locations', 'Api\LocationsController@index');
|
|
|
|
$route->get('/locations/{location_id:\d+}/shifts', 'Api\ShiftsController@entriesByLocation');
|
2023-11-03 23:27:31 +01:00
|
|
|
$route->get('/users/{user_id:\d+}/angeltypes', 'Api\AngelTypeController@ofUser');
|
2023-05-21 12:40:36 +02:00
|
|
|
|
|
|
|
$route->addRoute(
|
2023-07-31 00:26:19 +02:00
|
|
|
['POST', 'PUT', 'DELETE', 'PATCH'],
|
2023-07-22 20:35:45 +02:00
|
|
|
'/[{resource:.+}]',
|
|
|
|
'Api\IndexController@notImplemented'
|
2023-05-21 12:40:36 +02:00
|
|
|
);
|
2023-07-31 00:26:19 +02:00
|
|
|
$route->get('/[{resource:.+}]', 'Api\IndexController@notFound');
|
2023-05-21 12:40:36 +02:00
|
|
|
}
|
|
|
|
);
|
2023-07-31 00:26:19 +02:00
|
|
|
$route->get('/[{resource:.+}]', 'Api\IndexController@notFound');
|
2023-05-21 12:40:36 +02:00
|
|
|
}
|
|
|
|
);
|
2019-11-27 23:43:21 +01:00
|
|
|
|
2023-01-28 17:08:15 +01:00
|
|
|
// Feeds
|
|
|
|
$route->get('/atom', 'FeedController@atom');
|
2023-01-29 00:46:51 +01:00
|
|
|
$route->get('/ical', 'FeedController@ical');
|
2023-01-28 17:08:15 +01:00
|
|
|
$route->get('/rss', 'FeedController@rss');
|
2023-01-29 02:12:40 +01:00
|
|
|
$route->get('/shifts-json-export', 'FeedController@shifts');
|
2023-01-28 17:08:15 +01:00
|
|
|
|
2020-04-24 18:08:09 +02:00
|
|
|
// Design
|
|
|
|
$route->get('/design', 'DesignController@index');
|
|
|
|
|
2019-11-27 23:43:21 +01:00
|
|
|
// Administration
|
|
|
|
$route->addGroup(
|
|
|
|
'/admin',
|
2022-12-14 19:15:20 +01:00
|
|
|
function (RouteCollector $route): void {
|
2020-12-06 00:16:15 +01:00
|
|
|
// FAQ
|
|
|
|
$route->addGroup(
|
|
|
|
'/faq',
|
2022-12-14 19:15:20 +01:00
|
|
|
function (RouteCollector $route): void {
|
2022-12-11 18:01:34 +01:00
|
|
|
$route->get('[/{faq_id:\d+}]', 'Admin\\FaqController@edit');
|
|
|
|
$route->post('[/{faq_id:\d+}]', 'Admin\\FaqController@save');
|
2020-12-06 00:16:15 +01:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2020-05-01 16:29:28 +02:00
|
|
|
// Log
|
2022-12-11 18:01:34 +01:00
|
|
|
$route->addGroup(
|
|
|
|
'/logs',
|
2022-12-14 19:15:20 +01:00
|
|
|
function (RouteCollector $route): void {
|
2022-12-11 18:01:34 +01:00
|
|
|
$route->get('', 'Admin\\LogsController@index');
|
|
|
|
$route->post('', 'Admin\\LogsController@index');
|
|
|
|
}
|
|
|
|
);
|
2020-05-01 16:29:28 +02:00
|
|
|
|
2019-11-27 23:43:21 +01:00
|
|
|
// Schedule
|
|
|
|
$route->addGroup(
|
2020-04-07 15:08:49 +02:00
|
|
|
'/schedule',
|
2022-12-14 19:15:20 +01:00
|
|
|
function (RouteCollector $route): void {
|
2019-11-27 23:43:21 +01:00
|
|
|
$route->get('', 'Admin\\Schedule\\ImportSchedule@index');
|
2022-12-11 18:01:34 +01:00
|
|
|
$route->get('/edit[/{schedule_id:\d+}]', 'Admin\\Schedule\\ImportSchedule@edit');
|
|
|
|
$route->post('/edit[/{schedule_id:\d+}]', 'Admin\\Schedule\\ImportSchedule@save');
|
|
|
|
$route->get('/load/{schedule_id:\d+}', 'Admin\\Schedule\\ImportSchedule@loadSchedule');
|
|
|
|
$route->post('/import/{schedule_id:\d+}', 'Admin\\Schedule\\ImportSchedule@importSchedule');
|
2019-11-27 23:43:21 +01:00
|
|
|
}
|
|
|
|
);
|
2020-05-01 16:29:28 +02:00
|
|
|
|
2023-10-22 18:37:29 +02:00
|
|
|
// Shifts
|
|
|
|
$route->addGroup(
|
|
|
|
'/shifts',
|
|
|
|
function (RouteCollector $route): void {
|
|
|
|
$route->get('/history', 'Admin\\ShiftsController@history');
|
|
|
|
$route->post('/history', 'Admin\\ShiftsController@deleteTransaction');
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2023-10-25 02:42:11 +02:00
|
|
|
// Shift types
|
|
|
|
$route->addGroup(
|
|
|
|
'/shifttypes',
|
|
|
|
function (RouteCollector $route): void {
|
|
|
|
$route->get('', 'Admin\\ShiftTypesController@index');
|
|
|
|
$route->post('', 'Admin\\ShiftTypesController@delete');
|
|
|
|
$route->get('/{shift_type_id:\d+}', 'Admin\\ShiftTypesController@view');
|
|
|
|
$route->get('/edit[/{shift_type_id:\d+}]', 'Admin\\ShiftTypesController@edit');
|
|
|
|
$route->post('/edit[/{shift_type_id:\d+}]', 'Admin\\ShiftTypesController@save');
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2020-12-18 18:27:10 +01:00
|
|
|
// Questions
|
|
|
|
$route->addGroup(
|
|
|
|
'/questions',
|
2022-12-14 19:15:20 +01:00
|
|
|
function (RouteCollector $route): void {
|
2020-12-18 18:27:10 +01:00
|
|
|
$route->get('', 'Admin\\QuestionsController@index');
|
|
|
|
$route->post('', 'Admin\\QuestionsController@delete');
|
2022-12-11 18:01:34 +01:00
|
|
|
$route->get('/{question_id:\d+}', 'Admin\\QuestionsController@edit');
|
|
|
|
$route->post('/{question_id:\d+}', 'Admin\\QuestionsController@save');
|
2020-12-18 18:27:10 +01:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2023-10-15 19:25:55 +02:00
|
|
|
// Locations
|
2023-02-26 11:27:41 +01:00
|
|
|
$route->addGroup(
|
2023-10-15 19:25:55 +02:00
|
|
|
'/locations',
|
2023-02-26 11:27:41 +01:00
|
|
|
function (RouteCollector $route): void {
|
2023-10-15 19:25:55 +02:00
|
|
|
$route->get('', 'Admin\\LocationsController@index');
|
|
|
|
$route->post('', 'Admin\\LocationsController@delete');
|
|
|
|
$route->get('/edit[/{location_id:\d+}]', 'Admin\\LocationsController@edit');
|
|
|
|
$route->post('/edit[/{location_id:\d+}]', 'Admin\\LocationsController@save');
|
2023-02-26 11:27:41 +01:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2021-09-24 20:28:51 +02:00
|
|
|
// User
|
|
|
|
$route->addGroup(
|
2022-12-11 18:01:34 +01:00
|
|
|
'/user/{user_id:\d+}',
|
2022-12-14 19:15:20 +01:00
|
|
|
function (RouteCollector $route): void {
|
2022-12-08 17:40:24 +01:00
|
|
|
// Shirts
|
2022-12-11 18:01:34 +01:00
|
|
|
$route->addGroup(
|
2023-03-05 03:00:38 +01:00
|
|
|
'/goodie',
|
2022-12-14 19:15:20 +01:00
|
|
|
function (RouteCollector $route): void {
|
2022-12-11 18:01:34 +01:00
|
|
|
$route->get('', 'Admin\\UserShirtController@editShirt');
|
|
|
|
$route->post('', 'Admin\\UserShirtController@saveShirt');
|
|
|
|
}
|
|
|
|
);
|
2022-12-08 17:40:24 +01:00
|
|
|
|
|
|
|
// Worklogs
|
2022-12-11 18:01:34 +01:00
|
|
|
$route->addGroup(
|
|
|
|
'/worklog',
|
2022-12-14 19:15:20 +01:00
|
|
|
function (RouteCollector $route): void {
|
2022-12-11 18:01:34 +01:00
|
|
|
$route->get('[/{worklog_id:\d+}]', 'Admin\\UserWorkLogController@editWorklog');
|
|
|
|
$route->post('[/{worklog_id:\d+}]', 'Admin\\UserWorkLogController@saveWorklog');
|
|
|
|
$route->get(
|
|
|
|
'/{worklog_id:\d+}/delete',
|
|
|
|
'Admin\\UserWorkLogController@showDeleteWorklog'
|
|
|
|
);
|
|
|
|
$route->post(
|
|
|
|
'/{worklog_id:\d+}/delete',
|
|
|
|
'Admin\\UserWorkLogController@deleteWorklog'
|
|
|
|
);
|
|
|
|
}
|
2022-12-08 17:40:24 +01:00
|
|
|
);
|
2021-09-24 20:28:51 +02:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2020-05-01 16:29:28 +02:00
|
|
|
// News
|
2020-04-05 16:54:45 +02:00
|
|
|
$route->addGroup(
|
|
|
|
'/news',
|
2022-12-14 19:15:20 +01:00
|
|
|
function (RouteCollector $route): void {
|
2022-12-11 18:01:34 +01:00
|
|
|
$route->get('[/{news_id:\d+}]', 'Admin\\NewsController@edit');
|
|
|
|
$route->post('[/{news_id:\d+}]', 'Admin\\NewsController@save');
|
2020-04-05 16:54:45 +02:00
|
|
|
}
|
|
|
|
);
|
2019-11-27 23:43:21 +01:00
|
|
|
}
|
|
|
|
);
|