diff options
author | 2024-02-10 18:19:14 -0700 | |
---|---|---|
committer | 2024-02-13 06:59:44 +0530 | |
commit | 7584d2d7a7110aef0331ebfa178b2295842c59fa (patch) | |
tree | 900cd71237e6231b57936fcce77ff229cd459041 /start/routes/api.ts | |
parent | upgrade recipes submodule (diff) | |
download | ferdium-server-7584d2d7a7110aef0331ebfa178b2295842c59fa.tar.gz ferdium-server-7584d2d7a7110aef0331ebfa178b2295842c59fa.tar.zst ferdium-server-7584d2d7a7110aef0331ebfa178b2295842c59fa.zip |
refactor: project maintenance
- work in progress
Diffstat (limited to 'start/routes/api.ts')
-rw-r--r-- | start/routes/api.ts | 82 |
1 files changed, 39 insertions, 43 deletions
diff --git a/start/routes/api.ts b/start/routes/api.ts index 78282f0..8992154 100644 --- a/start/routes/api.ts +++ b/start/routes/api.ts | |||
@@ -1,51 +1,47 @@ | |||
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 Route from '@ioc:Adonis/Core/Route'; | 3 | import router from '@adonisjs/core/services/router' |
4 | const UserController = () => import('#controllers/Http/UserController') | ||
5 | const ServiceController = () => import('#controllers/Http/ServiceController') | ||
6 | const RecipeController = () => import('#controllers/Http/RecipeController') | ||
4 | 7 | ||
5 | Route.group(() => { | 8 | router |
6 | // User authentification | 9 | .group(() => { |
7 | Route.post('auth/signup', 'UserController.signup').middleware('guest'); | 10 | // User authentification |
8 | Route.post('auth/login', 'UserController.login').middleware('guest'); | 11 | router.post('auth/signup', [UserController, 'signup']).middleware('guest') |
12 | router.post('auth/login', [UserController, 'login']).middleware('guest') | ||
9 | 13 | ||
10 | // User info | 14 | // User info |
11 | Route.get('me', 'UserController.me').middleware('auth:jwt'); | 15 | router.get('me', [UserController, 'me']).middleware('auth:jwt') |
12 | Route.put('me', 'UserController.updateMe').middleware('auth:jwt'); | 16 | router.put('me', [UserController, 'updateMe']).middleware('auth:jwt') |
13 | Route.get('me/newtoken', 'UserController.newToken').middleware('auth:jwt'); | 17 | router.get('me/newtoken', [UserController, 'newToken']).middleware('auth:jwt') |
14 | 18 | ||
15 | // // Service info | 19 | // // Service info |
16 | Route.post('service', 'ServiceController.create').middleware('auth:jwt'); | 20 | router.post('service', [ServiceController, 'create']).middleware('auth:jwt') |
17 | Route.put('service/reorder', 'ServiceController.reorder').middleware( | 21 | router.put('service/reorder', [ServiceController, 'reorder']).middleware('auth:jwt') |
18 | 'auth:jwt', | 22 | router.put('service/:id', [ServiceController, 'edit']).middleware('auth:jwt') |
19 | ); | 23 | router.delete('service/:id', [ServiceController, 'delete']).middleware('auth:jwt') |
20 | Route.put('service/:id', 'ServiceController.edit').middleware('auth:jwt'); | 24 | router.get('me/services', [ServiceController, 'list']).middleware('auth:jwt') |
21 | Route.delete('service/:id', 'ServiceController.delete').middleware( | 25 | router.get('recipe', [ServiceController, 'list']).middleware('auth:jwt') |
22 | 'auth:jwt', | 26 | router.get('icon/:id', [ServiceController, 'icon']) |
23 | ); | ||
24 | Route.get('me/services', 'ServiceController.list').middleware('auth:jwt'); | ||
25 | Route.get('recipe', 'ServiceController.list').middleware('auth:jwt'); | ||
26 | Route.get('icon/:id', 'ServiceController.icon'); | ||
27 | 27 | ||
28 | // Recipe store | 28 | // Recipe store |
29 | Route.get('recipes', 'RecipeController.list'); | 29 | router.get('recipes', [RecipeController, 'list']) |
30 | Route.get('recipes/search', 'RecipeController.search'); | 30 | router.get('recipes/search', [RecipeController, 'search']) |
31 | Route.get('recipes/popular', 'RecipeController.popularRecipes'); | 31 | router.get('recipes/popular', [RecipeController, 'popularRecipes']) |
32 | Route.get('recipes/download/:recipe', 'RecipeController.download'); | 32 | router.get('recipes/download/:recipe', [RecipeController, 'download']) |
33 | Route.post('recipes/update', 'RecipeController.update'); | 33 | router.post('recipes/update', [RecipeController, 'update']) |
34 | 34 | ||
35 | // // Workspaces | 35 | // // Workspaces |
36 | Route.put('workspace/:id', 'WorkspaceController.edit').middleware('auth:jwt'); | 36 | router.put('workspace/:id', 'WorkspaceController.edit').middleware('auth:jwt') |
37 | Route.delete('workspace/:id', 'WorkspaceController.delete').middleware( | 37 | router.delete('workspace/:id', 'WorkspaceController.delete').middleware('auth:jwt') |
38 | 'auth:jwt', | 38 | router.post('workspace', 'WorkspaceController.create').middleware('auth:jwt') |
39 | ); | 39 | router.get('workspace', 'WorkspaceController.list').middleware('auth:jwt') |
40 | Route.post('workspace', 'WorkspaceController.create').middleware('auth:jwt'); | ||
41 | Route.get('workspace', 'WorkspaceController.list').middleware('auth:jwt'); | ||
42 | 40 | ||
43 | // Static responses | 41 | // Static responses |
44 | Route.get('features/:mode?', 'Api/Static/FeaturesController.show'); | 42 | router.get('features/:mode?', 'Api/Static/FeaturesController.show') |
45 | Route.get('services', 'Api/Static/EmptyController.show'); | 43 | router.get('services', 'Api/Static/EmptyController.show') |
46 | Route.get('news', 'Api/Static/EmptyController.show'); | 44 | router.get('news', 'Api/Static/EmptyController.show') |
47 | Route.get( | 45 | router.get('announcements/:version', 'Api/Static/AnnouncementsController.show') |
48 | 'announcements/:version', | 46 | }) |
49 | 'Api/Static/AnnouncementsController.show', | 47 | .prefix('/v1') |
50 | ); | ||
51 | }).prefix('/v1'); | ||