|
@@ -50,7 +50,7 @@ module.exports = (crowi) => {
|
|
|
* type: string
|
|
* type: string
|
|
|
*/
|
|
*/
|
|
|
router.get('/list', accessTokenParser, loginRequired, validator.retrieveAttachments, apiV3FormValidator, async(req, res) => {
|
|
router.get('/list', accessTokenParser, loginRequired, validator.retrieveAttachments, apiV3FormValidator, async(req, res) => {
|
|
|
- // const offset = +req.query.offset || 0;
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
const pageId = req.query.pageId;
|
|
const pageId = req.query.pageId;
|
|
@@ -63,11 +63,13 @@ module.exports = (crowi) => {
|
|
|
|
|
|
|
|
// directly get paging-size from db. not to delivery from client side.
|
|
// directly get paging-size from db. not to delivery from client side.
|
|
|
const pageLimitationS = await crowi.configManager.getConfig('crowi', 'customize:showPageLimitationS') || 10;
|
|
const pageLimitationS = await crowi.configManager.getConfig('crowi', 'customize:showPageLimitationS') || 10;
|
|
|
|
|
+ const selectedPage = req.query.selectedPage;
|
|
|
|
|
+ const offset = (selectedPage - 1) * pageLimitationS;
|
|
|
const paginateResult = await Attachment.paginate(
|
|
const paginateResult = await Attachment.paginate(
|
|
|
{ page: pageId },
|
|
{ page: pageId },
|
|
|
{
|
|
{
|
|
|
limit: pageLimitationS,
|
|
limit: pageLimitationS,
|
|
|
- // offset,
|
|
|
|
|
|
|
+ offset,
|
|
|
populate: {
|
|
populate: {
|
|
|
path: 'creator',
|
|
path: 'creator',
|
|
|
select: User.USER_PUBLIC_FIELDS,
|
|
select: User.USER_PUBLIC_FIELDS,
|