From 08360b5f68148f76366e5fb4dbdac8444ee98a6d Mon Sep 17 00:00:00 2001 From: 2004durgesh Date: Sun, 2 Jun 2024 09:08:48 +0530 Subject: [PATCH] feat(zoro): Add routes for anime schedule, studio, spotlight, & search suggestions (#619) --- src/routes/anime/zoro.ts | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/routes/anime/zoro.ts b/src/routes/anime/zoro.ts index ad65457b..572440bd 100644 --- a/src/routes/anime/zoro.ts +++ b/src/routes/anime/zoro.ts @@ -86,6 +86,38 @@ const routes = async (fastify: FastifyInstance, options: RegisterOptions) => { reply.status(200).send(res); }); + fastify.get('/schedule/:date', async (request: FastifyRequest, reply: FastifyReply) => { + const date = (request.params as { date: string }).date; + + const res = await zoro.fetchSchedule(date); + + reply.status(200).send(res); + }); + + fastify.get('/studio/:studioId', async (request: FastifyRequest, reply: FastifyReply) => { + const studioId = (request.params as { studioId: string }).studioId; + const page = (request.query as { page: number }).page ?? 1; + + const res = await zoro.fetchStudio(studioId, page); + + reply.status(200).send(res); + }); + + fastify.get('/spotlight', async (request: FastifyRequest, reply: FastifyReply) => { + const res = await zoro.fetchSpotlight(); + + reply.status(200).send(res); + }); + + fastify.get('/search-suggestions/:query', async (request: FastifyRequest, reply: FastifyReply) => { + const query = (request.params as { query: string }).query; + + const res = await zoro.fetchSearchSuggestions(query); + + reply.status(200).send(res); + }); + + fastify.get('/info', async (request: FastifyRequest, reply: FastifyReply) => { const id = (request.query as { id: string }).id;