@azteam/express 1.2.121 → 1.2.124
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 +6 -6
package/package.json
CHANGED
package/src/AdminController.js
CHANGED
|
@@ -114,8 +114,8 @@ class AdminController extends Controller {
|
|
|
114
114
|
};
|
|
115
115
|
|
|
116
116
|
|
|
117
|
-
async beforeModify(
|
|
118
|
-
return
|
|
117
|
+
async beforeModify(data, user) {
|
|
118
|
+
return data;
|
|
119
119
|
};
|
|
120
120
|
|
|
121
121
|
putModify() {
|
|
@@ -127,12 +127,12 @@ class AdminController extends Controller {
|
|
|
127
127
|
validateMiddleware(REQUEST_TYPE.BODY, this.options.rulesModify),
|
|
128
128
|
async (req, res) => {
|
|
129
129
|
|
|
130
|
-
let item = await this.
|
|
130
|
+
let item = await this.repository.findOneById(req.params.id);
|
|
131
131
|
if (!item) return res.error(NOT_EXISTS);
|
|
132
132
|
|
|
133
|
-
|
|
133
|
+
const data = await this.beforeModify(req.body, req.user);
|
|
134
134
|
|
|
135
|
-
item = await this.
|
|
135
|
+
item = await this.repository.modifyByUser(req.user.id, item, data);
|
|
136
136
|
|
|
137
137
|
return res.success(item, this.options.guardResponse, this.options.allowResponse);
|
|
138
138
|
}
|
|
@@ -175,4 +175,4 @@ class AdminController extends Controller {
|
|
|
175
175
|
};
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
-
export default AdminController;
|
|
178
|
+
export default AdminController;
|