@azteam/express 1.2.222 → 1.2.225
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 +15 -6
package/package.json
CHANGED
package/src/AdminController.js
CHANGED
|
@@ -118,11 +118,11 @@ class AdminController extends Controller {
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
methodPostCreatePublic = async (req, res) => {
|
|
121
|
-
const data = await this.beforeCreate(req.body
|
|
121
|
+
const data = await this.beforeCreate(req.body);
|
|
122
122
|
|
|
123
123
|
let item = await this.repository.createByUser(req.user.id, data);
|
|
124
124
|
|
|
125
|
-
item = await this.afterCreate(item
|
|
125
|
+
item = await this.afterCreate(item);
|
|
126
126
|
|
|
127
127
|
return res.success(item, this.guardResponse, this.allowResponse);
|
|
128
128
|
};
|
|
@@ -147,11 +147,13 @@ class AdminController extends Controller {
|
|
|
147
147
|
let item = await this.repository.findOneById(req.params.id);
|
|
148
148
|
if (!item) return res.error(NOT_EXISTS);
|
|
149
149
|
|
|
150
|
-
|
|
150
|
+
const data = await this.beforeModify(req.body);
|
|
151
|
+
|
|
152
|
+
item.loadData(data);
|
|
151
153
|
item.modified_id = req.user.id;
|
|
152
154
|
await item.save();
|
|
153
155
|
|
|
154
|
-
item = await this.afterModify(item
|
|
156
|
+
item = await this.afterModify(item);
|
|
155
157
|
|
|
156
158
|
return res.success(item, this.guardResponse, this.allowResponse);
|
|
157
159
|
};
|
|
@@ -199,7 +201,7 @@ class AdminController extends Controller {
|
|
|
199
201
|
const item = await this.repository.findOneById(req.params.id);
|
|
200
202
|
if (!item) return res.error(NOT_EXISTS);
|
|
201
203
|
|
|
202
|
-
await item.modifyStatusUnavailable(req.user.id);
|
|
204
|
+
await item.modifyStatusUnavailable(req.body.message, req.user.id);
|
|
203
205
|
|
|
204
206
|
return res.success(item, this.guardResponse, this.allowResponse);
|
|
205
207
|
},
|
|
@@ -242,7 +244,14 @@ class AdminController extends Controller {
|
|
|
242
244
|
}
|
|
243
245
|
|
|
244
246
|
methodDeleteDestroyTrash = async (req, res) => {
|
|
245
|
-
const item = await this.repository.
|
|
247
|
+
const item = await this.repository.findOne(
|
|
248
|
+
{
|
|
249
|
+
_id: req.params.id,
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
trash: true,
|
|
253
|
+
}
|
|
254
|
+
);
|
|
246
255
|
if (!item) return res.error(NOT_EXISTS);
|
|
247
256
|
|
|
248
257
|
await this.repository.destroy(item.id);
|