From 5fad14e3af00000db9dd8b5cfc3e5a5765a6ba00 Mon Sep 17 00:00:00 2001 From: Valentin Kaelin Date: Sat, 14 Nov 2020 18:47:17 +0100 Subject: [PATCH] fix(more-matches): update the sidebar with the season filter applied --- server/app/Controllers/Http/MatchesController.ts | 4 ++-- server/app/Validators/MatchesIndexValidator.ts | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/server/app/Controllers/Http/MatchesController.ts b/server/app/Controllers/Http/MatchesController.ts index 2cc41e9..d9c4a08 100644 --- a/server/app/Controllers/Http/MatchesController.ts +++ b/server/app/Controllers/Http/MatchesController.ts @@ -35,7 +35,7 @@ export default class MatchesController { */ public async index ({ request, response }: HttpContextContract) { console.log('More Matches Request') - const { puuid, accountId, region, gameIds } = await request.validate(MatchesIndexValidator) + const { puuid, accountId, region, gameIds, season } = await request.validate(MatchesIndexValidator) const summonerDB = await Summoner.findOne({ puuid }) if (!summonerDB) { @@ -45,7 +45,7 @@ export default class MatchesController { await summonerDB.save() - const stats = await StatsService.getSummonerStats(puuid) + const stats = await StatsService.getSummonerStats(puuid, season) return response.json({ matches, diff --git a/server/app/Validators/MatchesIndexValidator.ts b/server/app/Validators/MatchesIndexValidator.ts index 26c8dc5..adc0d9f 100644 --- a/server/app/Validators/MatchesIndexValidator.ts +++ b/server/app/Validators/MatchesIndexValidator.ts @@ -31,6 +31,7 @@ export default class MatchesIndexValidator { gameIds: schema.array().members( schema.number() ), + season: schema.number.optional(), }) /**