diff --git a/src/app/api/job-posting/siteRequestUtils.js b/src/app/api/job-posting/siteRequestUtils.js index c6976e4..a9761fc 100644 --- a/src/app/api/job-posting/siteRequestUtils.js +++ b/src/app/api/job-posting/siteRequestUtils.js @@ -124,15 +124,10 @@ export async function fetchJobPostings( if (sortCriteria && sortCriteria.datePosted !== undefined) { query = query.sort(sortCriteria); } - query = query.skip(skip); - + query = query.limit(pageSize).skip(skip); const documents = await query.exec(); - // Split the process and used slice instead of chaining with .limit() to avoid sorted order bug - // Todo: Investigate the bug and fix it - const paginatedDocuments = documents.slice(0, pageSize); - - return paginatedDocuments; + return documents; } // Function to check if the requested field exists in the schema diff --git a/vercel.json b/vercel.json new file mode 100644 index 0000000..d64c13a --- /dev/null +++ b/vercel.json @@ -0,0 +1,7 @@ +{ + "functions": { + "src/app/api/**/*": { + "maxDuration": 60 + } + } +}