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

fix validation and pageLimitationM number

zahmis 5 лет назад
Родитель
Сommit
490c1e3291

+ 1 - 1
src/server/routes/apiv3/attachment.js

@@ -27,7 +27,7 @@ module.exports = (crowi) => {
     retrieveAttachments: [
       query('pageId').isMongoId().withMessage('pageId is required'),
       query('pageLimitationS').custom((value) => {
-        if (value === undefined) {
+        if (value == null) {
           return 10;
         }
         if (value > 100) {

+ 2 - 2
src/server/routes/apiv3/bookmarks.js

@@ -146,10 +146,10 @@ module.exports = (crowi) => {
   validator.myBookmarkList = [
     query('selectPageNumber').isInt({ min: 1 }),
     query('pageLimitationM').custom((value) => {
-      if (value === undefined) {
+      if (value == null) {
         return 10;
       }
-      if (value > 100) {
+      if (value > 300) {
         throw new Error('You should set less than 100 or not to set pageLimitationM.');
       }
       return value;

+ 1 - 1
src/server/routes/apiv3/pages.js

@@ -88,7 +88,7 @@ module.exports = (crowi) => {
 
   validator.displayList = [
     query('pageLimitationS').custom((value) => {
-      if (value === undefined) {
+      if (value == null) {
         return 10;
       }
       if (value > 100) {

+ 1 - 1
src/server/routes/apiv3/revisions.js

@@ -71,7 +71,7 @@ module.exports = (crowi) => {
       query('pageId').isMongoId().withMessage('pageId is required'),
       query('selectedPage').isInt({ min: 0 }).withMessage('selectedPage must be int'),
       query('pageLimitationS').custom((value) => {
-        if (value === undefined) {
+        if (value == null) {
           return 10;
         }
         if (value > 100) {

+ 2 - 2
src/server/routes/apiv3/users.js

@@ -107,10 +107,10 @@ module.exports = (crowi) => {
 
   validator.recentCreatedByUser = [
     query('pageLimitationM').custom((value) => {
-      if (value === undefined) {
+      if (value == null) {
         return 10;
       }
-      if (value > 100) {
+      if (value > 300) {
         throw new Error('You should set less than 100 or not to set pageLimitationM.');
       }
       return value;