fix: multiple genre filtering now works (#3282)

pull/3283/head
Brandon Cohen 2 years ago committed by GitHub
parent f4a22dc437
commit 507693881b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -4418,7 +4418,7 @@ paths:
- in: query - in: query
name: genre name: genre
schema: schema:
type: number type: string
example: 18 example: 18
- in: query - in: query
name: network name: network

@ -85,7 +85,7 @@ interface DiscoverTvOptions {
voteAverageLte?: string; voteAverageLte?: string;
includeEmptyReleaseDate?: boolean; includeEmptyReleaseDate?: boolean;
originalLanguage?: string; originalLanguage?: string;
genre?: number; genre?: string;
network?: number; network?: number;
keywords?: string; keywords?: string;
sortBy?: SortOptions; sortBy?: SortOptions;

@ -356,7 +356,7 @@ discoverRoutes.get('/tv', async (req, res, next) => {
page: Number(query.page), page: Number(query.page),
sortBy: query.sortBy as SortOptions, sortBy: query.sortBy as SortOptions,
language: req.locale ?? query.language, language: req.locale ?? query.language,
genre: query.genre ? Number(query.genre) : undefined, genre: query.genre,
network: query.network ? Number(query.network) : undefined, network: query.network ? Number(query.network) : undefined,
firstAirDateLte: query.firstAirDateLte firstAirDateLte: query.firstAirDateLte
? new Date(query.firstAirDateLte).toISOString().split('T')[0] ? new Date(query.firstAirDateLte).toISOString().split('T')[0]
@ -491,7 +491,7 @@ discoverRoutes.get<{ genreId: string }>(
const data = await tmdb.getDiscoverTv({ const data = await tmdb.getDiscoverTv({
page: Number(req.query.page), page: Number(req.query.page),
language: req.locale ?? (req.query.language as string), language: req.locale ?? (req.query.language as string),
genre: Number(req.params.genreId), genre: req.params.genreId,
}); });
const media = await Media.getRelatedMedia( const media = await Media.getRelatedMedia(
@ -770,7 +770,9 @@ discoverRoutes.get<{ language: string }, GenreSliderItem[]>(
await Promise.all( await Promise.all(
genres.map(async (genre) => { genres.map(async (genre) => {
const genreData = await tmdb.getDiscoverTv({ genre: genre.id }); const genreData = await tmdb.getDiscoverTv({
genre: genre.id.toString(),
});
mappedGenres.push({ mappedGenres.push({
id: genre.id, id: genre.id,

Loading…
Cancel
Save