소스 검색

add grant

itizawa 5 년 전
부모
커밋
b1849972ee
1개의 변경된 파일10개의 추가작업 그리고 7개의 파일을 삭제
  1. 10 7
      src/server/routes/apiv3/pages.js

+ 10 - 7
src/server/routes/apiv3/pages.js

@@ -29,13 +29,16 @@ module.exports = (crowi) => {
   const globalNotificationService = crowi.getGlobalNotificationService();
   const globalNotificationService = crowi.getGlobalNotificationService();
   const { pageService, slackNotificationService } = crowi;
   const { pageService, slackNotificationService } = crowi;
 
 
-const validator = {
-  createPage: [
-    body('body').exists().not().isEmpty({ ignore_whitespace:true }).withMessage('body is required'),
-    body('path').exists().not().isEmpty({ ignore_whitespace:true }).withMessage('path is required'),
-
-  ],
-}
+  const validator = {
+    createPage: [
+      body('body').exists().not().isEmpty({ ignore_whitespace: true })
+        .withMessage('body is required'),
+      body('path').exists().not().isEmpty({ ignore_whitespace: true })
+        .withMessage('path is required'),
+      body('grant').if(value => value != null).isInt({ min: 1, max: 5 }).withMessage('grant must be integer from 1 to 5'),
+
+    ],
+  };
   // user notification
   // user notification
   // TODO GW-3387 create '/service/user-notification' module
   // TODO GW-3387 create '/service/user-notification' module
   /**
   /**