Add 'api/v1/tv/top-rated' route'

This commit is contained in:
2025-11-21 16:51:39 +02:00
parent 65e7ff90bd
commit a3a7aa2474
6 changed files with 19 additions and 36 deletions

View File

@@ -99,6 +99,9 @@ type KPFilmShort struct {
RatingVoteCount int `json:"ratingVoteCount"`
PosterUrl string `json:"posterUrl"`
PosterUrlPreview string `json:"posterUrlPreview"`
CoverUrl string `json:"coverUrl"`
LogoUrl string `json:"logoUrl"`
RatingAgeLimits string `json:"ratingAgeLimits"`
}
type KPCountry struct {

View File

@@ -339,6 +339,9 @@ func mapKPFilmShortToMovie(film KPFilmShort) *models.Movie {
posterPath = film.PosterUrl
}
// Backdrop path from coverUrl
backdropPath := film.CoverUrl
title := film.NameRu
if title == "" {
title = film.NameEn
@@ -373,6 +376,7 @@ func mapKPFilmShortToMovie(film KPFilmShort) *models.Movie {
OriginalTitle: originalTitle,
Overview: film.Description,
PosterPath: posterPath,
BackdropPath: backdropPath,
ReleaseDate: releaseDate,
VoteAverage: rating,
VoteCount: film.RatingVoteCount,
@@ -430,18 +434,18 @@ func mapKPFilmShortToTVShow(film KPFilmShort) *models.TVShow {
}
return &models.TVShow{
ID: id,
Name: title,
OriginalName: originalTitle,
Overview: film.Description,
PosterPath: posterPath,
FirstAirDate: releaseDate,
VoteAverage: rating,
VoteCount: film.RatingVoteCount,
Popularity: rating * 100,
Genres: genres,
KinopoiskID: id,
IMDbID: film.ImdbId,
ID: id,
Name: title,
OriginalName: originalTitle,
Overview: film.Description,
PosterPath: posterPath,
FirstAirDate: releaseDate,
VoteAverage: rating,
VoteCount: film.RatingVoteCount,
Popularity: rating * 100,
Genres: genres,
KinopoiskID: id,
IMDbID: film.ImdbId,
}
}

View File

@@ -92,10 +92,6 @@ func (s *MovieService) GetUpcoming(page int, language, region string) (*models.T
return s.tmdb.GetUpcomingMovies(page, language, region)
}
func (s *MovieService) GetNowPlaying(page int, language, region string) (*models.TMDBResponse, error) {
return s.tmdb.GetNowPlayingMovies(page, language, region)
}
func (s *MovieService) GetRecommendations(id, page int, language string) (*models.TMDBResponse, error) {
return s.tmdb.GetMovieRecommendations(id, page, language)
}