From d4b5f6e085c7a0dc60b3bc0a95d7d08745405d61 Mon Sep 17 00:00:00 2001 From: Shubham-md786 Date: Sat, 27 Jan 2024 23:34:49 +0530 Subject: [PATCH 1/2] feat: zoro extra routes --- src/routes/anime/zoro.ts | 53 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/src/routes/anime/zoro.ts b/src/routes/anime/zoro.ts index 4cd8f156..299dc347 100644 --- a/src/routes/anime/zoro.ts +++ b/src/routes/anime/zoro.ts @@ -29,12 +29,63 @@ const routes = async (fastify: FastifyInstance, options: RegisterOptions) => { async (request: FastifyRequest, reply: FastifyReply) => { const page = (request.query as { page: number }).page; - const res = await zoro.fetchRecentEpisodes(page); + const res = await zoro.fetchRecentlyUpdated(page); reply.status(200).send(res); }, ); + fastify.get('/top-airing', async (request: FastifyRequest, reply: FastifyReply) => { + const page = (request.query as { page: number }).page; + + const res = await zoro.fetchTopAiring(page); + + reply.status(200).send(res); + }); + + fastify.get('most-popular', async (request: FastifyRequest, reply: FastifyReply) => { + const page = (request.query as { page: number }).page; + + const res = await zoro.fetchMostPopular(page); + + reply.status(200).send(res); + }); + + fastify.get('/most-favorite', async (request: FastifyRequest, reply: FastifyReply) => { + const page = (request.query as { page: number }).page; + + const res = await zoro.fetchMostFavorite(page); + + reply.status(200).send(res); + }); + + fastify.get( + '/latest-completed', + async (request: FastifyRequest, reply: FastifyReply) => { + const page = (request.query as { page: number }).page; + + const res = await zoro.fetchLatestCompleted(page); + + reply.status(200).send(res); + }, + ); + + fastify.get('/recent-added', async (request: FastifyRequest, reply: FastifyReply) => { + const page = (request.query as { page: number }).page; + + const res = await zoro.fetchRecentlyAdded(page); + + reply.status(200).send(res); + }); + + fastify.get('top-upcoming', async (request: FastifyRequest, reply: FastifyReply) => { + const page = (request.query as { page: number }).page; + + const res = await zoro.fetchTopUpcoming(page); + + reply.status(200).send(res); + }); + fastify.get('/info', async (request: FastifyRequest, reply: FastifyReply) => { const id = (request.query as { id: string }).id; From 570f27c39c8211fb145c3df69e973e55e22dc384 Mon Sep 17 00:00:00 2001 From: Shubham-md786 Date: Sun, 28 Jan 2024 09:17:28 +0530 Subject: [PATCH 2/2] fix: zoro routes --- src/routes/anime/zoro.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/routes/anime/zoro.ts b/src/routes/anime/zoro.ts index 299dc347..78f098be 100644 --- a/src/routes/anime/zoro.ts +++ b/src/routes/anime/zoro.ts @@ -43,7 +43,7 @@ const routes = async (fastify: FastifyInstance, options: RegisterOptions) => { reply.status(200).send(res); }); - fastify.get('most-popular', async (request: FastifyRequest, reply: FastifyReply) => { + fastify.get('/most-popular', async (request: FastifyRequest, reply: FastifyReply) => { const page = (request.query as { page: number }).page; const res = await zoro.fetchMostPopular(page); @@ -78,7 +78,7 @@ const routes = async (fastify: FastifyInstance, options: RegisterOptions) => { reply.status(200).send(res); }); - fastify.get('top-upcoming', async (request: FastifyRequest, reply: FastifyReply) => { + fastify.get('/top-upcoming', async (request: FastifyRequest, reply: FastifyReply) => { const page = (request.query as { page: number }).page; const res = await zoro.fetchTopUpcoming(page);