Просмотр исходного кода

Merge branch 'imprv/refacter-recursively' into imprv/refactor-revertDelete

zamis 5 лет назад
Родитель
Сommit
91fcfcbf8a
1 измененных файлов с 5 добавлено и 3 удалено
  1. 5 3
      src/server/routes/apiv3/pages.js

+ 5 - 3
src/server/routes/apiv3/pages.js

@@ -423,7 +423,9 @@ module.exports = (crowi) => {
     return res.apiv3(result);
     return res.apiv3(result);
   });
   });
 
 
-
+  validator.emptyTrash = [
+    query('socketClientId').if(value => value != null).isInt().withMessage('socketClientId must be int'),
+  ];
   /**
   /**
    * @swagger
    * @swagger
    *
    *
@@ -435,8 +437,8 @@ module.exports = (crowi) => {
    *          200:
    *          200:
    *            description: Succeeded to remove all trash pages
    *            description: Succeeded to remove all trash pages
    */
    */
-  router.delete('/empty-trash', loginRequired, adminRequired, csrf, async(req, res) => {
-    const socketClientId = req.query.socketClientId;
+  router.delete('/empty-trash', accessTokenParser, loginRequired, adminRequired, csrf, validator.emptyTrash, apiV3FormValidator, async(req, res) => {
+    const socketClientId = parseInt(req.query.socketClientId);
     const options = { socketClientId };
     const options = { socketClientId };
 
 
     try {
     try {