feat: add pagination metadata to all list endpoints

- Add pagination.helper.js with addPaginationMeta function
- Add pagination info to: most-popular, search, new-release, newly-added, latest-updated, az-list, filter, category, status
- Pagination includes: currentPage, totalPages, totalItems, itemsPerPage, hasNext, hasPrev
- Fix creatorInfo middleware to include message field
This commit is contained in:
Shinei Nouzen
2026-07-04 16:14:30 +05:30
parent 646ef128a8
commit e8b63b5d16
9 changed files with 95 additions and 18 deletions
+4 -2
View File
@@ -18,6 +18,7 @@
import { extractAzList } from "../extractors/azList.extractor.js";
import { getCache, setCache, TTL } from "../helper/cache.helper.js";
import { addPaginationMeta } from "../helper/pagination.helper.js";
// ══════════════════════════════════════════════════════════════
// CONTROLLER: A-Z LIST
@@ -51,8 +52,9 @@ const getAzList = async (req, res, next) => {
return res.json({ success: true, results: cached });
}
const data = await extractAzList(letter, page);
setCache(cacheKey, data, TTL.genres);
res.json({ success: true, results: data });
const response = addPaginationMeta(data, page);
setCache(cacheKey, response, TTL.genres);
res.json({ success: true, results: response });
} catch (error) {
next(error);
}