refactor: clean code and remove unnecessary dependencies

This commit is contained in:
ner committed 2024-09-30 18:54:13 +03:00
1 parent eceae6fec7
commit ebf599eed6
92 files changed
+1152 -2842

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
const mapMoviesSeriesResponseToShows = (
{ total_pages, page, results }: TMDBPagination<Movie> | TMDBPagination<Series>,
type: Show['type'] = 'movie'
): Pagination<Show> => ({
page,
total: total_pages,
results: results
.map(({ id, overview, backdrop_path, poster_path, vote_average, vote_count, ...item }) => ({
id,
type,
overview,
backdrop: backdrop_path,
poster: poster_path,
rating: vote_average,
votes: vote_count,
release: 'release_date' in item ? item.release_date : item.first_air_date,
title: 'release_date' in item ? item.title : item.name,
genres: []
}))
.filter((show) => show.votes && show.release)
});
export default mapMoviesSeriesResponseToShows;