mirror of
https://github.com/Shineii86/AniKotoAPI.git
synced 2026-10-22 10:55:10 +00:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user