mirror of
https://github.com/Shineii86/AniKotoAPI.git
synced 2026-10-22 10:55:10 +00:00
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:
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* ======= • ======= • ======= • ======= • =======• =======
|
||||
* AniKotoAPI — completedAnime.controller.js
|
||||
* Repository: https://github.com/Shineii86/AniKotoAPI
|
||||
*
|
||||
* @description
|
||||
* Controller for completed anime section. Returns list of anime
|
||||
* that have finished airing from the homepage.
|
||||
*
|
||||
* @exports
|
||||
* getCompletedAnime - Express route handler for GET /api/completed
|
||||
*
|
||||
* @author Shinei Nouzen
|
||||
* @license MIT
|
||||
* ======= • ======= • ======= • ======= • =======• =======
|
||||
*/
|
||||
|
||||
import { extractCompletedAnime } from "../extractors/completedAnime.extractor.js";
|
||||
import { getCache, setCache, TTL } from "../helper/cache.helper.js";
|
||||
|
||||
// ══════════════════════════════════════════════════════════════
|
||||
// CONTROLLER: COMPLETED ANIME
|
||||
// ══════════════════════════════════════════════════════════════
|
||||
|
||||
// ---- FEATURE: Completed anime endpoint ----
|
||||
/**
|
||||
* Handles GET /api/completed requests. Returns list of anime
|
||||
* that have finished airing from the homepage section.
|
||||
*
|
||||
* @param {object} req - Express request object
|
||||
* @param {object} res - Express response object
|
||||
* @param {Function} next - Express next middleware function
|
||||
* @returns {void} Sends JSON response with completed anime list
|
||||
*
|
||||
* @example
|
||||
* GET /api/completed
|
||||
* Response: { success: true, results: [...], ... }
|
||||
*/
|
||||
const getCompletedAnime = async (req, res, next) => {
|
||||
try {
|
||||
const cacheKey = "completed";
|
||||
const cached = getCache(cacheKey);
|
||||
if (cached) {
|
||||
return res.json({ success: true, results: cached });
|
||||
}
|
||||
const data = await extractCompletedAnime();
|
||||
setCache(cacheKey, data, TTL.default);
|
||||
res.json({ success: true, results: data });
|
||||
} catch (error) {
|
||||
next(error);
|
||||
}
|
||||
};
|
||||
|
||||
export { getCompletedAnime };
|
||||
|
||||
// ══════════════════════════════════════════════════════════════ END: completedAnime.controller.js
|
||||
Reference in New Issue
Block a user