routes.php 3.65 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php

/*
 * This file is part of Anis Server.
 *
 * (c) Laboratoire d'Astrophysique de Marseille / CNRS
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
declare(strict_types=1);

use Slim\Routing\RouteCollectorProxy;

$app->get('/', App\Action\RootAction::class);
16
17

$app->group('', function (RouteCollectorProxy $group) {
18
19
20
21
    $group->map([OPTIONS, GET, POST], '/select', App\Action\SelectListAction::class);
    $group->map([OPTIONS, GET, PUT, DELETE], '/select/{name}', App\Action\SelectAction::class);
    $group->map([OPTIONS, GET, POST], '/option', App\Action\OptionListAction::class);
    $group->map([OPTIONS, GET, PUT, DELETE], '/option/{id}', App\Action\OptionAction::class);
22
23
24
    $group->map([OPTIONS, GET, POST], '/database', App\Action\DatabaseListAction::class);
    $group->map([OPTIONS, GET, PUT, DELETE], '/database/{id}', App\Action\DatabaseAction::class);
    $group->map([OPTIONS, GET], '/database/{id}/table', App\Action\TableListAction::class);
25
26
27
})->add(new App\Middleware\AdminMiddleware($container->get(SETTINGS)['token'], false));

$app->group('', function (RouteCollectorProxy $group) {
28
29
30
31
    $group->map([OPTIONS, GET, POST], '/project', App\Action\ProjectListAction::class);
    $group->map([OPTIONS, GET, PUT, DELETE], '/project/{name}', App\Action\ProjectAction::class);
    $group->map([OPTIONS, GET, POST], '/instance', App\Action\InstanceListAction::class);
    $group->map([OPTIONS, GET, PUT, DELETE], '/instance/{name}', App\Action\InstanceAction::class);
32
    $group->map([OPTIONS, GET, POST], '/instance/{name}/group', App\Action\GroupListAction::class);
33
34
    $group->map([OPTIONS, GET, POST], '/instance/{name}/dataset-family', App\Action\DatasetFamilyListAction::class);
    $group->map([OPTIONS, GET], '/instance/{name}/dataset', App\Action\DatasetListByInstanceAction::class);
35
    $group->map([OPTIONS, GET, PUT, DELETE], '/group/{id}', App\Action\GroupAction::class);
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
    $group->map([OPTIONS, GET, PUT, DELETE], '/dataset-family/{id}', App\Action\DatasetFamilyAction::class);
    $group->map([OPTIONS, GET, POST], '/dataset-family/{id}/dataset', App\Action\DatasetListAction::class);
    $group->map([OPTIONS, GET, PUT, DELETE], '/dataset/{name}', App\Action\DatasetAction::class);
    $group->map([OPTIONS, GET, POST], '/dataset/{name}/criteria-family', App\Action\CriteriaFamilyListAction::class);
    $group->map([OPTIONS, GET, PUT, DELETE], '/criteria-family/{id}', App\Action\CriteriaFamilyAction::class);
    $group->map([OPTIONS, GET, POST], '/dataset/{name}/output-family', App\Action\OutputFamilyListAction::class);
    $group->map([OPTIONS, GET, PUT, DELETE], '/output-family/{id}', App\Action\OutputFamilyAction::class);
    $group->map([OPTIONS, GET], '/dataset/{name}/output-category', App\Action\OutputCategoryListByDatasetAction::class);
    $group->map(
        [OPTIONS, GET, POST],
        '/output-family/{id}/output-category',
        App\Action\OutputCategoryListAction::class
    );
    $group->map([OPTIONS, GET, PUT, DELETE], '/output-category/{id}', App\Action\OutputCategoryAction::class);
    $group->map([OPTIONS, GET], '/dataset/{name}/attribute', App\Action\AttributeListAction::class);
    $group->map([OPTIONS, GET, PUT], '/dataset/{name}/attribute/{id}', App\Action\AttributeAction::class);
    $group->map(
        [OPTIONS, GET, PUT],
        '/dataset/{name}/attribute/{id}/distinct',
        App\Action\AttributeDistinctAction::class
    );
57
})->add(new App\Middleware\AdminMiddleware($container->get(SETTINGS)['token'], true));
58

59
$app->get('/search/{dname}', App\Action\SearchAction::class);
François Agneray's avatar
François Agneray committed
60
$app->get('/download-file/{dname}/[{fpath:.*}]', App\Action\DownloadFileAction::class);