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 { extractStatus } from "../extractors/status.extractor.js";
|
||||
import { getCache, setCache, TTL } from "../helper/cache.helper.js";
|
||||
import { addPaginationMeta } from "../helper/pagination.helper.js";
|
||||
|
||||
// ══════════════════════════════════════════════════════════════
|
||||
// CONTROLLER: STATUS
|
||||
@@ -62,8 +63,9 @@ const getStatus = async (req, res, next) => {
|
||||
};
|
||||
const mappedStatus = statusMap[status] || status;
|
||||
const data = await extractStatus(mappedStatus, 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