diff options
author | 2024-02-10 18:37:40 -0700 | |
---|---|---|
committer | 2024-02-13 06:59:44 +0530 | |
commit | e1c47572a6235fd8fd20af888ac3a11c7ae1369d (patch) | |
tree | 2dccff36a441916d7014037cef3f7ce84a790cad /start/routes/api.ts | |
parent | refactor: project maintenance (diff) | |
download | ferdium-server-e1c47572a6235fd8fd20af888ac3a11c7ae1369d.tar.gz ferdium-server-e1c47572a6235fd8fd20af888ac3a11c7ae1369d.tar.zst ferdium-server-e1c47572a6235fd8fd20af888ac3a11c7ae1369d.zip |
updates
Diffstat (limited to 'start/routes/api.ts')
-rw-r--r-- | start/routes/api.ts | 81 |
1 files changed, 51 insertions, 30 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'); |