zahmis 5 лет назад
Родитель
Сommit
9afb76ef43
2 измененных файлов с 1 добавлено и 9 удалено
  1. 0 8
      src/server/models/attachment.js
  2. 1 1
      src/server/routes/apiv3/attachment.js

+ 0 - 8
src/server/models/attachment.js

@@ -65,14 +65,6 @@ module.exports = function(crowi) {
     return attachment;
     return attachment;
   };
   };
 
 
-  attachmentSchema.static.paginateAttachments = function() {
-    const query = {};
-    const options = Object.assign({ populate: 'user' });
-    if (options.page == null) {
-      options.page = 1;
-    }
-    return this.paginate(query, options);
-  };
 
 
   return mongoose.model('Attachment', attachmentSchema);
   return mongoose.model('Attachment', attachmentSchema);
 };
 };

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

@@ -54,7 +54,7 @@ module.exports = (crowi) => {
       }
       }
 
 
       const attachments = await Attachment.find({ page: pageId });
       const attachments = await Attachment.find({ page: pageId });
-      const pagination = await Attachment.paginate({}, { queryOptions });
+      const pagination = await Attachment.paginate({ page: pageId }, { queryOptions });
 
 
       const result = { attachments, pagination };
       const result = { attachments, pagination };