|
|
@@ -39,9 +39,6 @@ module.exports = (crowi) => {
|
|
|
* type: string
|
|
|
*/
|
|
|
router.get('/list', accessTokenParser, loginRequired, async(req, res) => {
|
|
|
- const offset = +req.query.offset || 0;
|
|
|
- const limit = +req.query.limit || 30;
|
|
|
- const queryOptions = { offset, limit };
|
|
|
|
|
|
try {
|
|
|
const pageId = req.query.pageId;
|
|
|
@@ -54,7 +51,13 @@ module.exports = (crowi) => {
|
|
|
}
|
|
|
|
|
|
const attachments = await Attachment.find({ page: pageId });
|
|
|
- const pagination = await Attachment.paginate({ page: pageId }, { queryOptions });
|
|
|
+ const pagination = await Attachment.paginate(
|
|
|
+ { page: pageId },
|
|
|
+ {
|
|
|
+ offset: +req.query.offset || 0,
|
|
|
+ limit: +req.query.limit || 30,
|
|
|
+ },
|
|
|
+ );
|
|
|
|
|
|
const result = { attachments, pagination };
|
|
|
|