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');
|
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');
|
|
|
|
$route->get('/oauth', 'SettingsController@oauth');
|
|
|
|
}
|
|
|
|
);
|
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
|
|
|
|
$route->get('/api[/{resource:.+}]', 'ApiController@index');
|
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
|
|
|
|
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-02-26 11:27:41 +01:00
|
|
|
// Rooms
|
|
|
|
$route->addGroup(
|
|
|
|
'/rooms',
|
|
|
|
function (RouteCollector $route): void {
|
|
|
|
$route->get('', 'Admin\\RoomsController@index');
|
|
|
|
$route->post('', 'Admin\\RoomsController@delete');
|
|
|
|
$route->get('/edit[/{room_id:\d+}]', 'Admin\\RoomsController@edit');
|
|
|
|
$route->post('/edit[/{room_id:\d+}]', 'Admin\\RoomsController@save');
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
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(
|
|
|
|
'/shirt',
|
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
|
|
|
}
|
|
|
|
);
|