feat: Add new endpoints and enhance filter — v2.2.0

New Endpoints (4 new routes):
- GET /api/upcoming — upcoming anime releases from homepage
- GET /api/top-rankings?sort=top|newest — ranked anime with sort modes
- GET /api/recently-updated?tab=all|dub|sub — filtered recent updates
- GET /api/completed — finished anime series from homepage

Enhanced Filter (/api/filter):
- Added source parameter (18 source material types)
- Added epMin/epMax for episode range filtering
- Added excludeWatchlist parameter for logged-in users
- Added season parameter (spring/summer/fall/winter)

New Config IDs:
- SOURCE_IDS: 18 source material type mappings
- SEASON_IDS: 4 broadcast season mappings
- EXTENDED_TYPE_IDS: Added tv-short and tv-special types

Total endpoints: 34 (was 30)
OpenAPI spec updated with new endpoints
CHANGELOG.md updated with comprehensive change history
This commit is contained in:
Shinei Nouzen
2026-07-28 19:45:25 +05:30
parent a8f1917ce7
commit fd29b02158
12 changed files with 751 additions and 9 deletions
@@ -0,0 +1,58 @@
/*
* ======= • ======= • ======= • ======= • =======• =======
* AniKotoAPI — topAnimeRankings.controller.js
* Repository: https://github.com/Shineii86/AniKotoAPI
*
* @description
* Controller for top anime rankings. Returns ranked anime list
* with support for top (all-time) and newest sort modes.
*
* @exports
* getTopAnimeRankings - Express route handler for GET /api/top-rankings
*
* @author Shinei Nouzen
* @license MIT
* ======= • ======= • ======= • ======= • =======• =======
*/
import { extractTopAnimeRankings } from "../extractors/topAnimeRankings.extractor.js";
import { getCache, setCache, TTL } from "../helper/cache.helper.js";
// ══════════════════════════════════════════════════════════════
// CONTROLLER: TOP ANIME RANKINGS
// ══════════════════════════════════════════════════════════════
// ---- FEATURE: Top anime rankings endpoint ----
/**
* Handles GET /api/top-rankings requests. Returns ranked anime list
* with support for top (all-time) and newest sort modes.
*
* @param {object} req - Express request object
* @param {string} [req.query.sort="top"] - Sort mode: "top" or "newest"
* @param {object} res - Express response object
* @param {Function} next - Express next middleware function
* @returns {void} Sends JSON response with ranked anime list
*
* @example
* GET /api/top-rankings?sort=top
* Response: { success: true, results: [{ rank: 1, title: "...", ... }] }
*/
const getTopAnimeRankings = async (req, res, next) => {
try {
const { sort = "top" } = req.query;
const cacheKey = `top_rankings_${sort}`;
const cached = getCache(cacheKey);
if (cached) {
return res.json({ success: true, results: cached });
}
const data = await extractTopAnimeRankings(sort);
setCache(cacheKey, data, TTL.trending);
res.json({ success: true, results: data });
} catch (error) {
next(error);
}
};
export { getTopAnimeRankings };
// ══════════════════════════════════════════════════════════════ END: topAnimeRankings.controller.js