Skip to content

Commit

Permalink
Fixed GET /rounds/latest/plays endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Volodymyr-Kuchinskyi committed May 21, 2024
1 parent 02b8fae commit 60b61e6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions server/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,8 @@ async function main() {
res.json({ data: plays, total });
});

app.get('/rounds/:round_id/plays', pagination(), async (req: Request<FindPlaysByRoundParams, never, never, PaginationParams>, res: Response) => {
const [plays, total] = await playsRepository.getPaginatedPlays({
roundId: req.params.round_id,
},{
app.get('/rounds/latest/plays', pagination(), async (req: Request<never, never, never, PaginationParams>, res: Response) => {
const [plays, total] = await playsRepository.getLatestRoundPlays({
limit: req.query.limit,
offset: req.query.offset,
});
Expand All @@ -84,8 +82,10 @@ async function main() {
res.json({ data: plays, total });
});

app.get('/rounds/latest/plays', pagination(), async (req: Request<never, never, never, PaginationParams>, res: Response) => {
const [plays, total] = await playsRepository.getLatestRoundPlays({
app.get('/rounds/:round_id/plays', pagination(), async (req: Request<FindPlaysByRoundParams, never, never, PaginationParams>, res: Response) => {
const [plays, total] = await playsRepository.getPaginatedPlays({
roundId: req.params.round_id,
},{
limit: req.query.limit,
offset: req.query.offset,
});
Expand Down

0 comments on commit 60b61e6

Please sign in to comment.