From 60b61e6337c106e4074801792f1c333535880188 Mon Sep 17 00:00:00 2001 From: VolodymyrK Date: Tue, 21 May 2024 14:48:59 +0000 Subject: [PATCH] Fixed GET /rounds/latest/plays endpoint --- server/src/api.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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, });