@azteam/express 1.2.117 → 1.2.118

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": "@azteam/express",
3
- "version": "1.2.117",
3
+ "version": "1.2.118",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "repository": {
@@ -1,14 +1,13 @@
1
1
  import { NOT_EXISTS, PERMISSION } from '@azteam/error';
2
2
 
3
3
  import { HTTP_METHOD, paginateMiddleware, REQUEST_TYPE, roleMiddleware, validateMiddleware, rulesID } from './ApiServer';
4
+ import Controller from './Controller';
5
+
4
6
  import { USER_LEVEL } from './constant';
5
7
 
6
8
 
7
- class Controller {
9
+ class AdminController extends Controller {
8
10
  constructor(pathName, repository, options = {}) {
9
- this.pathName = pathName;
10
- this.repository = repository;
11
-
12
11
  this.options = {
13
12
  roles: {
14
13
  READ: 1,
@@ -23,11 +22,28 @@ class Controller {
23
22
 
24
23
  guardResponse: {},
25
24
  allowResponse: {},
26
-
25
+
27
26
  ...options,
28
27
  }
28
+
29
+ super(pathName, repository);
29
30
  }
30
31
 
32
+
33
+ usePublic(controllers = []){
34
+ return super([
35
+ getPaginate,
36
+ getPaginateTrash,
37
+ getOne,
38
+ getOneTrash,
39
+ postCreate,
40
+ putModify,
41
+ deleteOne,
42
+ postRestore,
43
+ ]);
44
+ }
45
+
46
+
31
47
  getPaginate() {
32
48
  return {
33
49
  path: `/${this.pathName}`,
@@ -140,7 +156,7 @@ class Controller {
140
156
  }
141
157
  }
142
158
 
143
- delete() {
159
+ deleteOne() {
144
160
  return {
145
161
  path: `/${this.pathName}/:id`,
146
162
  method: [
@@ -172,7 +188,6 @@ class Controller {
172
188
  },
173
189
  ],
174
190
  }
175
-
176
191
  },
177
192
  }
178
193
 
@@ -0,0 +1,21 @@
1
+ import { NOT_EXISTS, PERMISSION } from '@azteam/error';
2
+
3
+ import { HTTP_METHOD, paginateMiddleware, REQUEST_TYPE, roleMiddleware, validateMiddleware, rulesID } from './ApiServer';
4
+ import { USER_LEVEL } from './constant';
5
+
6
+
7
+ class Controller {
8
+ constructor(pathName, repository) {
9
+ this.pathName = pathName;
10
+ this.repository = repository;
11
+ }
12
+
13
+
14
+ usePublic(controllers = []) {
15
+ return [
16
+ ...controllers
17
+ ]
18
+ }
19
+ }
20
+
21
+ export default Controller;