@azteam/express 1.2.221 → 1.2.222
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 +38 -0
package/package.json
CHANGED
package/src/AdminController.js
CHANGED
|
@@ -169,6 +169,44 @@ class AdminController extends Controller {
|
|
|
169
169
|
};
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
+
putModifyStatusAvailablePublic() {
|
|
173
|
+
return {
|
|
174
|
+
disabled: !this.roles.UPDATE,
|
|
175
|
+
path: '/available/:id',
|
|
176
|
+
method: [
|
|
177
|
+
adminRoleMiddleware([this.roles.UPDATE]),
|
|
178
|
+
validateMiddleware(REQUEST_TYPE.PARAMS, rulesId),
|
|
179
|
+
async (req, res) => {
|
|
180
|
+
const item = await this.repository.findOneById(req.params.id);
|
|
181
|
+
if (!item) return res.error(NOT_EXISTS);
|
|
182
|
+
|
|
183
|
+
await item.modifyStatusAvailable(req.user.id);
|
|
184
|
+
|
|
185
|
+
return res.success(item, this.guardResponse, this.allowResponse);
|
|
186
|
+
},
|
|
187
|
+
],
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
putModifyStatusUnavailablePublic() {
|
|
192
|
+
return {
|
|
193
|
+
disabled: !this.roles.UPDATE,
|
|
194
|
+
path: '/unavailable/:id',
|
|
195
|
+
method: [
|
|
196
|
+
adminRoleMiddleware([this.roles.UPDATE]),
|
|
197
|
+
validateMiddleware(REQUEST_TYPE.PARAMS, rulesId),
|
|
198
|
+
async (req, res) => {
|
|
199
|
+
const item = await this.repository.findOneById(req.params.id);
|
|
200
|
+
if (!item) return res.error(NOT_EXISTS);
|
|
201
|
+
|
|
202
|
+
await item.modifyStatusUnavailable(req.user.id);
|
|
203
|
+
|
|
204
|
+
return res.success(item, this.guardResponse, this.allowResponse);
|
|
205
|
+
},
|
|
206
|
+
],
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
|
|
172
210
|
methodDeletePublic = async (req, res) => {
|
|
173
211
|
const item = await this.repository.findOneById(req.params.id);
|
|
174
212
|
if (!item) return res.error(NOT_EXISTS);
|