@azteam/express 1.2.225 → 1.2.226
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 +1 -1
- package/src/AdminController.js +14 -0
package/package.json
CHANGED
package/src/AdminController.js
CHANGED
|
@@ -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,6 +249,10 @@ 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
|
{
|
|
@@ -254,8 +264,12 @@ class AdminController extends Controller {
|
|
|
254
264
|
);
|
|
255
265
|
if (!item) return res.error(NOT_EXISTS);
|
|
256
266
|
|
|
267
|
+
const oldItem = 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
|
|