@azteam/express 1.2.225 → 1.2.228

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.225",
3
+ "version": "1.2.228",
4
4
  "main": "src/index.js",
5
5
  "engines": {
6
6
  "node": ">= 12.0.0",
@@ -209,12 +209,18 @@ class AdminController extends Controller {
209
209
  };
210
210
  }
211
211
 
212
+ async afterDelete(item) {
213
+ return item;
214
+ }
215
+
212
216
  methodDeletePublic = async (req, res) => {
213
217
  const item = await this.repository.findOneById(req.params.id);
214
218
  if (!item) return res.error(NOT_EXISTS);
215
219
 
216
220
  await item.delete(req.user.id);
217
221
 
222
+ await this.afterDelete(item);
223
+
218
224
  return res.success(true);
219
225
  };
220
226
 
@@ -243,19 +249,27 @@ class AdminController extends Controller {
243
249
  };
244
250
  }
245
251
 
252
+ async afterDestroy(item) {
253
+ return item;
254
+ }
255
+
246
256
  methodDeleteDestroyTrash = async (req, res) => {
247
257
  const item = await this.repository.findOne(
248
258
  {
249
259
  _id: req.params.id,
250
260
  },
251
261
  {
252
- trash: true,
262
+ force: true,
253
263
  }
254
264
  );
255
265
  if (!item) return res.error(NOT_EXISTS);
256
266
 
267
+ const oldItem = _.cloneDeep(item);
268
+
257
269
  await this.repository.destroy(item.id);
258
270
 
271
+ await this.afterDestroy(oldItem);
272
+
259
273
  return res.success(true);
260
274
  };
261
275