Skip to content

Commit

Permalink
feat(zoro): Add routes for anime schedule, studio, spotlight, & searc…
Browse files Browse the repository at this point in the history
…h suggestions (#619)
  • Loading branch information
2004durgesh committed Jun 2, 2024
1 parent cb37014 commit 08360b5
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/routes/anime/zoro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 08360b5

Please sign in to comment.