diff options
Diffstat (limited to 'start/routes')
-rw-r--r-- | start/routes/api.ts | 81 | ||||
-rw-r--r-- | start/routes/web.ts | 64 |
2 files changed, 87 insertions, 58 deletions
diff --git a/start/routes/api.ts b/start/routes/api.ts index 8992154..77c3046 100644 --- a/start/routes/api.ts +++ b/start/routes/api.ts | |||
@@ -1,47 +1,68 @@ | |||
1 | // As this is currently a rebuild of the initial API we it is grouped in /v2/ | 1 | // As this is currently a rebuild of the initial API we it is grouped in /v2/ |
2 | 2 | ||
3 | import router from '@adonisjs/core/services/router' | 3 | import router from '@adonisjs/core/services/router'; |
4 | const UserController = () => import('#controllers/Http/UserController') | 4 | const UserController = () => import('#controllers/Http/UserController'); |
5 | const ServiceController = () => import('#controllers/Http/ServiceController') | 5 | const ServiceController = () => import('#controllers/Http/ServiceController'); |
6 | const RecipeController = () => import('#controllers/Http/RecipeController') | 6 | const RecipeController = () => import('#controllers/Http/RecipeController'); |
7 | 7 | ||
8 | router | 8 | router |
9 | .group(() => { | 9 | .group(() => { |
10 | // User authentification | 10 | // User authentification |
11 | router.post('auth/signup', [UserController, 'signup']).middleware('guest') | 11 | router.post('auth/signup', [UserController, 'signup']).middleware('guest'); |
12 | router.post('auth/login', [UserController, 'login']).middleware('guest') | 12 | router.post('auth/login', [UserController, 'login']).middleware('guest'); |
13 | 13 | ||
14 | // User info | 14 | // User info |
15 | router.get('me', [UserController, 'me']).middleware('auth:jwt') | 15 | router.get('me', [UserController, 'me']).middleware('auth:jwt'); |
16 | router.put('me', [UserController, 'updateMe']).middleware('auth:jwt') | 16 | router.put('me', [UserController, 'updateMe']).middleware('auth:jwt'); |
17 | router.get('me/newtoken', [UserController, 'newToken']).middleware('auth:jwt') | 17 | router |
18 | .get('me/newtoken', [UserController, 'newToken']) | ||
19 | .middleware('auth:jwt'); | ||
18 | 20 | ||
19 | // // Service info | 21 | // // Service info |
20 | router.post('service', [ServiceController, 'create']).middleware('auth:jwt') | 22 | router |
21 | router.put('service/reorder', [ServiceController, 'reorder']).middleware('auth:jwt') | 23 | .post('service', [ServiceController, 'create']) |
22 | router.put('service/:id', [ServiceController, 'edit']).middleware('auth:jwt') | 24 | .middleware('auth:jwt'); |
23 | router.delete('service/:id', [ServiceController, 'delete']).middleware('auth:jwt') | 25 | router |
24 | router.get('me/services', [ServiceController, 'list']).middleware('auth:jwt') | 26 | .put('service/reorder', [ServiceController, 'reorder']) |
25 | router.get('recipe', [ServiceController, 'list']).middleware('auth:jwt') | 27 | .middleware('auth:jwt'); |
26 | router.get('icon/:id', [ServiceController, 'icon']) | 28 | router |
29 | .put('service/:id', [ServiceController, 'edit']) | ||
30 | .middleware('auth:jwt'); | ||
31 | router | ||
32 | .delete('service/:id', [ServiceController, 'delete']) | ||
33 | .middleware('auth:jwt'); | ||
34 | router | ||
35 | .get('me/services', [ServiceController, 'list']) | ||
36 | .middleware('auth:jwt'); | ||
37 | router.get('recipe', [ServiceController, 'list']).middleware('auth:jwt'); | ||
38 | router.get('icon/:id', [ServiceController, 'icon']); | ||
27 | 39 | ||
28 | // Recipe store | 40 | // Recipe store |
29 | router.get('recipes', [RecipeController, 'list']) | 41 | router.get('recipes', [RecipeController, 'list']); |
30 | router.get('recipes/search', [RecipeController, 'search']) | 42 | router.get('recipes/search', [RecipeController, 'search']); |
31 | router.get('recipes/popular', [RecipeController, 'popularRecipes']) | 43 | router.get('recipes/popular', [RecipeController, 'popularRecipes']); |
32 | router.get('recipes/download/:recipe', [RecipeController, 'download']) | 44 | router.get('recipes/download/:recipe', [RecipeController, 'download']); |
33 | router.post('recipes/update', [RecipeController, 'update']) | 45 | router.post('recipes/update', [RecipeController, 'update']); |
34 | 46 | ||
35 | // // Workspaces | 47 | // // Workspaces |
36 | router.put('workspace/:id', 'WorkspaceController.edit').middleware('auth:jwt') | 48 | router |
37 | router.delete('workspace/:id', 'WorkspaceController.delete').middleware('auth:jwt') | 49 | .put('workspace/:id', 'WorkspaceController.edit') |
38 | router.post('workspace', 'WorkspaceController.create').middleware('auth:jwt') | 50 | .middleware('auth:jwt'); |
39 | router.get('workspace', 'WorkspaceController.list').middleware('auth:jwt') | 51 | router |
52 | .delete('workspace/:id', 'WorkspaceController.delete') | ||
53 | .middleware('auth:jwt'); | ||
54 | router | ||
55 | .post('workspace', 'WorkspaceController.create') | ||
56 | .middleware('auth:jwt'); | ||
57 | router.get('workspace', 'WorkspaceController.list').middleware('auth:jwt'); | ||
40 | 58 | ||
41 | // Static responses | 59 | // Static responses |
42 | router.get('features/:mode?', 'Api/Static/FeaturesController.show') | 60 | router.get('features/:mode?', 'Api/Static/FeaturesController.show'); |
43 | router.get('services', 'Api/Static/EmptyController.show') | 61 | router.get('services', 'Api/Static/EmptyController.show'); |
44 | router.get('news', 'Api/Static/EmptyController.show') | 62 | router.get('news', 'Api/Static/EmptyController.show'); |
45 | router.get('announcements/:version', 'Api/Static/AnnouncementsController.show') | 63 | router.get( |
64 | 'announcements/:version', | ||
65 | 'Api/Static/AnnouncementsController.show', | ||
66 | ); | ||
46 | }) | 67 | }) |
47 | .prefix('/v1') | 68 | .prefix('/v1'); |
diff --git a/start/routes/web.ts b/start/routes/web.ts index fd12bf2..2907e62 100644 --- a/start/routes/web.ts +++ b/start/routes/web.ts | |||
@@ -1,14 +1,14 @@ | |||
1 | import router from '@adonisjs/core/services/router' | 1 | import router from '@adonisjs/core/services/router'; |
2 | 2 | ||
3 | // Health check | 3 | // Health check |
4 | router.get('health', 'HealthController.index') | 4 | router.get('health', 'HealthController.index'); |
5 | 5 | ||
6 | // Legal documents | 6 | // Legal documents |
7 | router.get('terms', ({ response }) => response.redirect('/terms.html')) | 7 | router.get('terms', ({ response }) => response.redirect('/terms.html')); |
8 | router.get('privacy', ({ response }) => response.redirect('/privacy.html')) | 8 | router.get('privacy', ({ response }) => response.redirect('/privacy.html')); |
9 | 9 | ||
10 | // Index | 10 | // Index |
11 | router.get('/', ({ view }) => view.render('others/index')) | 11 | router.get('/', ({ view }) => view.render('others/index')); |
12 | 12 | ||
13 | router | 13 | router |
14 | .group(() => { | 14 | .group(() => { |
@@ -17,46 +17,54 @@ router | |||
17 | // Guest troutes | 17 | // Guest troutes |
18 | router | 18 | router |
19 | .group(() => { | 19 | .group(() => { |
20 | router.get('login', 'Dashboard/LoginController.show') | 20 | router.get('login', 'Dashboard/LoginController.show'); |
21 | router.post('login', 'Dashboard/LoginController.login').as('login') | 21 | router.post('login', 'Dashboard/LoginController.login').as('login'); |
22 | 22 | ||
23 | // Reset password | 23 | // Reset password |
24 | router.get('forgot', 'Dashboard/ForgotPasswordController.show') | 24 | router.get('forgot', 'Dashboard/ForgotPasswordController.show'); |
25 | router.post('forgot', 'Dashboard/ForgotPasswordController.forgotPassword') | 25 | router.post( |
26 | 'forgot', | ||
27 | 'Dashboard/ForgotPasswordController.forgotPassword', | ||
28 | ); | ||
26 | 29 | ||
27 | router.get('reset', 'Dashboard/ResetPasswordController.show') | 30 | router.get('reset', 'Dashboard/ResetPasswordController.show'); |
28 | router.post('reset', 'Dashboard/ResetPasswordController.resetPassword') | 31 | router.post( |
32 | 'reset', | ||
33 | 'Dashboard/ResetPasswordController.resetPassword', | ||
34 | ); | ||
29 | }) | 35 | }) |
30 | .middleware(['dashboard', 'guest']) | 36 | .middleware(['dashboard', 'guest']); |
31 | 37 | ||
32 | // Authenticated routes | 38 | // Authenticated routes |
33 | router | 39 | router |
34 | .group(() => { | 40 | .group(() => { |
35 | router.get('account', 'Dashboard/AccountController.show') | 41 | router.get('account', 'Dashboard/AccountController.show'); |
36 | router.post('account', 'Dashboard/AccountController.store') | 42 | router.post('account', 'Dashboard/AccountController.store'); |
37 | 43 | ||
38 | router.get('data', 'Dashboard/DataController.show') | 44 | router.get('data', 'Dashboard/DataController.show'); |
39 | router.get('export', 'Dashboard/ExportController.show') | 45 | router.get('export', 'Dashboard/ExportController.show'); |
40 | 46 | ||
41 | router.get('transfer', 'Dashboard/TransferController.show') | 47 | router.get('transfer', 'Dashboard/TransferController.show'); |
42 | router.post('transfer', 'Dashboard/TransferController.import') | 48 | router.post('transfer', 'Dashboard/TransferController.import'); |
43 | 49 | ||
44 | router.get('delete', 'Dashboard/DeleteController.show') | 50 | router.get('delete', 'Dashboard/DeleteController.show'); |
45 | router.post('delete', 'Dashboard/DeleteController.delete') | 51 | router.post('delete', 'Dashboard/DeleteController.delete'); |
46 | 52 | ||
47 | router.get('logout', 'Dashboard/LogOutController.logout') | 53 | router.get('logout', 'Dashboard/LogOutController.logout'); |
48 | 54 | ||
49 | router.get('*', ({ response }) => response.redirect('/user/account')) | 55 | router.get('*', ({ response }) => |
56 | response.redirect('/user/account'), | ||
57 | ); | ||
50 | }) | 58 | }) |
51 | .middleware(['dashboard', 'auth:web']) | 59 | .middleware(['dashboard', 'auth:web']); |
52 | }) | 60 | }) |
53 | .prefix('user') | 61 | .prefix('user'); |
54 | 62 | ||
55 | // Franz/Ferdi account import | 63 | // Franz/Ferdi account import |
56 | router.get('import', ({ view }) => view.render('others/import')) | 64 | router.get('import', ({ view }) => view.render('others/import')); |
57 | router.post('import', 'UserController.import') | 65 | router.post('import', 'UserController.import'); |
58 | 66 | ||
59 | // 404 handler | 67 | // 404 handler |
60 | router.get('/*', ({ response }) => response.redirect('/')) | 68 | router.get('/*', ({ response }) => response.redirect('/')); |
61 | }) | 69 | }) |
62 | .middleware(['dashboard']) | 70 | .middleware(['dashboard']); |