@azteam/express 1.2.240 → 1.2.242

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.240",
3
+ "version": "1.2.242",
4
4
  "main": "src/index.js",
5
5
  "engines": {
6
6
  "node": ">= 12.0.0",
@@ -11,19 +11,24 @@ class AdminController extends Controller {
11
11
  super(pathName, repository);
12
12
 
13
13
  this.roles = {
14
+ EXEC: null,
14
15
  READ: null,
15
16
  CREATE: null,
16
17
  UPDATE: null,
17
18
  DELETE: null,
18
19
  RESTORE: null,
19
20
  DESTROY: null,
21
+ IMPORT: null,
22
+ EXPORT: null,
20
23
 
21
24
  ...options.roles,
22
25
  };
23
26
 
24
27
  this.paginateOptions = options.paginateOptions || {};
25
- this.guardResponse = options.guardResponse || {};
26
- this.allowResponse = options.allowResponse || {};
28
+ this.guardResponse = options.guardResponse || [];
29
+ this.allowResponse = options.allowResponse
30
+ ? [...options.allowResponse, 'created_id', 'modified_id', 'restored_id', 'deleted_id']
31
+ : ['created_id', 'modified_id', 'restored_id', 'deleted_id'];
27
32
 
28
33
  this.rulesCreate =
29
34
  {
@@ -179,7 +184,7 @@ class AdminController extends Controller {
179
184
  adminRoleMiddleware([this.roles.UPDATE]),
180
185
  validateMiddleware(REQUEST_TYPE.PARAMS, rulesId),
181
186
  async (req, res) => {
182
- const item = await this.repository.findOneById(req.params.id);
187
+ let item = await this.repository.findOneById(req.params.id);
183
188
  if (!item) return res.error(NOT_EXISTS);
184
189
 
185
190
  await item.modifyStatusAvailable(req.user.id);
@@ -200,7 +205,7 @@ class AdminController extends Controller {
200
205
  adminRoleMiddleware([this.roles.UPDATE]),
201
206
  validateMiddleware(REQUEST_TYPE.PARAMS, rulesId),
202
207
  async (req, res) => {
203
- const item = await this.repository.findOneById(req.params.id);
208
+ let item = await this.repository.findOneById(req.params.id);
204
209
  if (!item) return res.error(NOT_EXISTS);
205
210
 
206
211
  await item.modifyStatusUnavailable(req.body.message, req.user.id);
@@ -221,7 +226,7 @@ class AdminController extends Controller {
221
226
  adminRoleMiddleware([this.roles.UPDATE]),
222
227
  validateMiddleware(REQUEST_TYPE.PARAMS, rulesId),
223
228
  async (req, res) => {
224
- const item = await this.repository.findOneById(req.params.id);
229
+ let item = await this.repository.findOneById(req.params.id);
225
230
  if (!item) return res.error(NOT_EXISTS);
226
231
 
227
232
  await item.modifyStatusWaiting(req.user.id);