rad-api 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rad-api",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "RAD pour créer des routes, controller, model ... etc",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1,11 +1,11 @@
1
1
  import { Router } from 'express';
2
2
  import {
3
- all,
4
- getById,
3
+ findAll,
4
+ findById,
5
5
  search,
6
6
  create,
7
7
  update,
8
- deleteItem
8
+ remove
9
9
  } from '../controllers/{{TABLE_SINGULAR}}.controller.js';
10
10
  import { authMiddleware } from '../middlewares/auth.middleware.js';
11
11
 
@@ -35,7 +35,7 @@ const router = Router();
35
35
  * 201:
36
36
  * description: {{TABLE_SINGULAR}} created
37
37
  */
38
- router.get('/', all);
38
+ router.get('/', findAll);
39
39
  router.post('/', create);
40
40
 
41
41
  /**
@@ -98,8 +98,8 @@ router.get('/search', search);
98
98
  * 404:
99
99
  * description: {{TABLE_SINGULAR}} not found
100
100
  */
101
- router.get('/:id', getById);
101
+ router.get('/:id', findById);
102
102
  router.put('/:id', update);
103
- router.delete('/:id', deleteItem);
103
+ router.delete('/:id', remove);
104
104
 
105
105
  export default router;
@@ -13,8 +13,11 @@ export function getOutputPath(tableName, type = 'route', pathOverride = 'output'
13
13
  } else {
14
14
  cwd = pathOverride;
15
15
  }
16
-
17
- return path.join(cwd, `${tableName}.${type}.js`);
16
+ let fileType = type;
17
+ if(type==='route'){
18
+ fileType = 'routes';
19
+ }
20
+ return path.join(cwd, `${tableName}.${fileType}.js`);
18
21
  }
19
22
 
20
23
  export function fileExists(filePath) {
@@ -1,5 +1,5 @@
1
1
  export function capitalize(str) {
2
- return str.charAt(0).toUpperCase() + str.slice(1);
2
+ return str.charAt(0).toLowerCase() + str.slice(1);
3
3
  }
4
4
 
5
5
  export function singularize(word) {