2024-03-14 19:25:27 +00:00
|
|
|
import router from '@adonisjs/core/services/router';
|
2023-03-03 15:54:28 +00:00
|
|
|
|
2024-03-14 19:25:27 +00:00
|
|
|
import AuthorsController from '#controllers/Http/Api/AuthorsController';
|
|
|
|
import DatasetController from '#controllers/Http/Api/DatasetController';
|
|
|
|
import HomeController from '#controllers/Http/Api/HomeController';
|
|
|
|
import FileController from '#controllers/Http/Api/FileController';
|
|
|
|
import AvatarController from '#controllers/Http/Api/AvatarController';
|
|
|
|
import UserController from '#controllers/Http/Api/UserController';
|
|
|
|
import { middleware } from '../kernel.js'
|
2023-03-03 15:54:28 +00:00
|
|
|
// API
|
2024-03-14 19:25:27 +00:00
|
|
|
router.group(() => {
|
|
|
|
|
2023-03-03 15:54:28 +00:00
|
|
|
|
2024-03-14 19:25:27 +00:00
|
|
|
|
|
|
|
router.get('authors', [AuthorsController, "index"]).as('author.index');
|
|
|
|
router.get('datasets', [DatasetController, "index"]).as('dataset.index');
|
|
|
|
router.get('persons', [AuthorsController, "persons"]).as('author.persons');
|
|
|
|
|
|
|
|
router.get('/dataset', [DatasetController, "findAll"]).as('dataset.findAll');
|
|
|
|
router.get('/dataset/:publish_id', [DatasetController, "findOne"]).as('dataset.findOne');
|
|
|
|
router.get('/sitelinks/:year', [HomeController, "findDocumentsPerYear"]);
|
|
|
|
router.get('/years', [HomeController, "findYears"]);
|
|
|
|
router.get('/statistic/:year', [HomeController, "findPublicationsPerMonth"]);
|
2023-11-22 16:06:55 +00:00
|
|
|
|
2024-03-14 19:25:27 +00:00
|
|
|
router.get('/download/:id', [FileController, "findOne"]).as('file.findOne');
|
2023-12-15 16:17:33 +00:00
|
|
|
|
2024-03-14 19:25:27 +00:00
|
|
|
router.get('/avatar/:name/:background?/:textColor?/:size?', [AvatarController, 'generateAvatar']);
|
2024-01-19 14:33:46 +00:00
|
|
|
|
|
|
|
|
2024-03-14 19:25:27 +00:00
|
|
|
router.post('/twofactor_totp/settings/enable/:state/:code?', [UserController, 'enable']).as('apps.twofactor_totp.enable') .use(middleware.auth());
|
|
|
|
|
2023-03-03 15:54:28 +00:00
|
|
|
})
|
2024-03-14 19:25:27 +00:00
|
|
|
// .namespace('App/Controllers/Http/Api')
|
2023-06-22 15:20:04 +00:00
|
|
|
.prefix('api');
|