diff --git a/server/src/api.ts b/server/src/api.ts index 718e284..05050ee 100644 --- a/server/src/api.ts +++ b/server/src/api.ts @@ -71,10 +71,8 @@ async function main() { res.json({ data: plays, total }); }); - app.get('/rounds/:round_id/plays', pagination(), async (req: Request, res: Response) => { - const [plays, total] = await playsRepository.getPaginatedPlays({ - roundId: req.params.round_id, - },{ + app.get('/rounds/latest/plays', pagination(), async (req: Request, res: Response) => { + const [plays, total] = await playsRepository.getLatestRoundPlays({ limit: req.query.limit, offset: req.query.offset, }); @@ -84,8 +82,10 @@ async function main() { res.json({ data: plays, total }); }); - app.get('/rounds/latest/plays', pagination(), async (req: Request, res: Response) => { - const [plays, total] = await playsRepository.getLatestRoundPlays({ + app.get('/rounds/:round_id/plays', pagination(), async (req: Request, res: Response) => { + const [plays, total] = await playsRepository.getPaginatedPlays({ + roundId: req.params.round_id, + },{ limit: req.query.limit, offset: req.query.offset, });