From 507693881b939819413f0959df5ef6b7a357eb5c Mon Sep 17 00:00:00 2001 From: Brandon Cohen Date: Thu, 26 Jan 2023 17:10:02 -0500 Subject: [PATCH] fix: multiple genre filtering now works (#3282) --- overseerr-api.yml | 2 +- server/api/themoviedb/index.ts | 2 +- server/routes/discover.ts | 8 +++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/overseerr-api.yml b/overseerr-api.yml index ef31c749d..443a9c948 100644 --- a/overseerr-api.yml +++ b/overseerr-api.yml @@ -4418,7 +4418,7 @@ paths: - in: query name: genre schema: - type: number + type: string example: 18 - in: query name: network diff --git a/server/api/themoviedb/index.ts b/server/api/themoviedb/index.ts index 7aad32c1e..4c931ff97 100644 --- a/server/api/themoviedb/index.ts +++ b/server/api/themoviedb/index.ts @@ -85,7 +85,7 @@ interface DiscoverTvOptions { voteAverageLte?: string; includeEmptyReleaseDate?: boolean; originalLanguage?: string; - genre?: number; + genre?: string; network?: number; keywords?: string; sortBy?: SortOptions; diff --git a/server/routes/discover.ts b/server/routes/discover.ts index ce9e3afff..2c3c665f1 100644 --- a/server/routes/discover.ts +++ b/server/routes/discover.ts @@ -356,7 +356,7 @@ discoverRoutes.get('/tv', async (req, res, next) => { page: Number(query.page), sortBy: query.sortBy as SortOptions, language: req.locale ?? query.language, - genre: query.genre ? Number(query.genre) : undefined, + genre: query.genre, network: query.network ? Number(query.network) : undefined, firstAirDateLte: query.firstAirDateLte ? new Date(query.firstAirDateLte).toISOString().split('T')[0] @@ -491,7 +491,7 @@ discoverRoutes.get<{ genreId: string }>( const data = await tmdb.getDiscoverTv({ page: Number(req.query.page), language: req.locale ?? (req.query.language as string), - genre: Number(req.params.genreId), + genre: req.params.genreId, }); const media = await Media.getRelatedMedia( @@ -770,7 +770,9 @@ discoverRoutes.get<{ language: string }, GenreSliderItem[]>( await Promise.all( genres.map(async (genre) => { - const genreData = await tmdb.getDiscoverTv({ genre: genre.id }); + const genreData = await tmdb.getDiscoverTv({ + genre: genre.id.toString(), + }); mappedGenres.push({ id: genre.id,