engelsystem/config/routes.php

283 lines
10 KiB
PHP
Raw Normal View History

<?php
declare(strict_types=1);
use FastRoute\RouteCollector;
/** @var RouteCollector $route */
// 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');
$route->get('/health', 'HealthController@index');
2018-10-25 18:53:05 +02:00
// Authentication
$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
$route->addGroup(
'/oauth/{provider}',
function (RouteCollector $route): void {
$route->get('', 'OAuthController@index');
$route->post('/connect', 'OAuthController@connect');
$route->post('/disconnect', 'OAuthController@disconnect');
}
);
2020-11-15 18:47:30 +01:00
// User settings
$route->addGroup(
'/settings',
function (RouteCollector $route): void {
$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('/certificates', 'SettingsController@certificate');
$route->post('/certificates/ifsg', 'SettingsController@saveIfsgCertificate');
$route->post('/certificates/driving', 'SettingsController@saveDrivingLicense');
2023-11-16 18:20:50 +01:00
$route->get('/api', 'SettingsController@api');
$route->post('/api', 'SettingsController@apiKeyReset');
$route->get('/oauth', 'SettingsController@oauth');
$route->get('/sessions', 'SettingsController@sessions');
$route->post('/sessions', 'SettingsController@sessionsDelete');
}
);
2020-11-15 18:47:30 +01:00
2019-10-08 16:17:06 +02:00
// Password recovery
$route->addGroup(
'/password/reset',
function (RouteCollector $route): void {
$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
// Stats
$route->get('/metrics', 'Metrics\\Controller@metrics');
$route->get('/stats', 'Metrics\\Controller@stats');
2023-02-13 19:28:10 +01:00
// Angeltypes
$route->addGroup('/angeltypes', function (RouteCollector $route): void {
$route->get('/about', 'AngelTypesController@about');
});
// Shifts
$route->addGroup('/shifts', function (RouteCollector $route): void {
$route->get('/random', 'ShiftsController@random');
});
2020-04-05 16:54:45 +02:00
// News
$route->get('/meetings', 'NewsController@meetings');
$route->addGroup(
'/news',
function (RouteCollector $route): void {
$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
$route->addGroup(
'/questions',
function (RouteCollector $route): void {
$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
// Messages
$route->addGroup(
'/messages',
function (RouteCollector $route): void {
$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');
}
);
// API
2023-05-21 12:40:36 +02:00
$route->addGroup(
'/api',
function (RouteCollector $route): void {
$route->get('', 'Api\IndexController@index');
2023-05-21 12:40:36 +02:00
$route->addGroup(
'/v0-beta',
function (RouteCollector $route): void {
$route->addRoute(['OPTIONS'], '[/{resource:.+}]', 'Api\IndexController@options');
$route->get('', 'Api\IndexController@indexV0');
$route->get('/openapi', 'Api\IndexController@openApiV0');
$route->get('/info', 'Api\IndexController@info');
2023-05-21 12:40:36 +02:00
$route->get('/angeltypes', 'Api\AngelTypeController@index');
$route->get('/angeltypes/{angeltype_id:\d+}/shifts', 'Api\ShiftsController@entriesByAngeltype');
$route->get('/locations', 'Api\LocationsController@index');
$route->get('/locations/{location_id:\d+}/shifts', 'Api\ShiftsController@entriesByLocation');
$route->get('/news', 'Api\NewsController@index');
$route->get('/users/{user_id:(?:\d+|self)}', 'Api\UsersController@user');
$route->get('/users/{user_id:(?:\d+|self)}/angeltypes', 'Api\AngelTypeController@ofUser');
$route->get('/users/{user_id:(?:\d+|self)}/shifts', 'Api\ShiftsController@entriesByUser');
2023-05-21 12:40:36 +02:00
$route->addRoute(
['POST', 'PUT', 'DELETE', 'PATCH'],
'/[{resource:.+}]',
'Api\IndexController@notImplemented'
2023-05-21 12:40:36 +02:00
);
$route->get('/[{resource:.+}]', 'Api\IndexController@notFound');
2023-05-21 12:40:36 +02:00
}
);
$route->get('/[{resource:.+}]', 'Api\IndexController@notFound');
2023-05-21 12:40:36 +02:00
}
);
// Feeds
$route->get('/atom', 'FeedController@atom');
2023-01-29 00:46:51 +01:00
$route->get('/ical', 'FeedController@ical');
$route->get('/rss', 'FeedController@rss');
2023-01-29 02:12:40 +01:00
$route->get('/shifts-json-export', 'FeedController@shifts');
// Design
$route->get('/design', 'DesignController@index');
// Administration
$route->addGroup(
'/admin',
function (RouteCollector $route): void {
2020-12-06 00:16:15 +01:00
// FAQ
$route->addGroup(
'/faq',
function (RouteCollector $route): void {
$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
$route->addGroup(
'/logs',
function (RouteCollector $route): void {
$route->get('', 'Admin\\LogsController@index');
$route->post('', 'Admin\\LogsController@index');
}
);
2020-05-01 16:29:28 +02:00
// Schedule
$route->addGroup(
'/schedule',
function (RouteCollector $route): void {
$route->get('', 'Admin\\ScheduleController@index');
$route->get('/edit[/{schedule_id:\d+}]', 'Admin\\ScheduleController@edit');
$route->post('/edit[/{schedule_id:\d+}]', 'Admin\\ScheduleController@save');
$route->get('/load/{schedule_id:\d+}', 'Admin\\ScheduleController@loadSchedule');
$route->post('/import/{schedule_id:\d+}', 'Admin\\ScheduleController@importSchedule');
}
);
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',
function (RouteCollector $route): void {
2020-12-18 18:27:10 +01:00
$route->get('', 'Admin\\QuestionsController@index');
$route->post('', 'Admin\\QuestionsController@delete');
$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(
'/user/{user_id:\d+}',
function (RouteCollector $route): void {
2022-12-08 17:40:24 +01:00
// Shirts
$route->addGroup(
'/goodie',
function (RouteCollector $route): void {
$route->get('', 'Admin\\UserShirtController@editShirt');
$route->post('', 'Admin\\UserShirtController@saveShirt');
}
);
2022-12-08 17:40:24 +01:00
// Worklogs
$route->addGroup(
'/worklog',
function (RouteCollector $route): void {
$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',
function (RouteCollector $route): void {
$route->get('[/{news_id:\d+}]', 'Admin\\NewsController@edit');
$route->post('[/{news_id:\d+}]', 'Admin\\NewsController@save');
2020-04-05 16:54:45 +02:00
}
);
}
);