feat(api): add unified models, mappers, and prefixed routes (movie/tv/search)

This commit is contained in:
Erno
2025-10-19 08:46:25 +00:00
parent 855cc0920c
commit 43af05cf91
7 changed files with 579 additions and 85 deletions

View File

@@ -67,7 +67,8 @@ func Handler(w http.ResponseWriter, r *http.Request) {
tvHandler := handlersPkg.NewTVHandler(tvService)
favoritesHandler := handlersPkg.NewFavoritesHandler(favoritesService, globalCfg)
docsHandler := handlersPkg.NewDocsHandler()
searchHandler := handlersPkg.NewSearchHandler(tmdbService, kpService)
searchHandler := handlersPkg.NewSearchHandler(tmdbService, kpService)
unifiedHandler := handlersPkg.NewUnifiedHandler(tmdbService, kpService)
categoriesHandler := handlersPkg.NewCategoriesHandler(tmdbService)
playersHandler := handlersPkg.NewPlayersHandler(globalCfg)
torrentsHandler := handlersPkg.NewTorrentsHandler(torrentService, tmdbService)
@@ -123,7 +124,11 @@ func Handler(w http.ResponseWriter, r *http.Request) {
api.HandleFunc("/movies/top-rated", movieHandler.TopRated).Methods("GET")
api.HandleFunc("/movies/upcoming", movieHandler.Upcoming).Methods("GET")
api.HandleFunc("/movies/now-playing", movieHandler.NowPlaying).Methods("GET")
api.HandleFunc("/movies/{id}", movieHandler.GetByID).Methods("GET")
api.HandleFunc("/movies/{id}", movieHandler.GetByID).Methods("GET")
// Unified prefixed routes
api.HandleFunc("/movie/{id}", unifiedHandler.GetMovie).Methods("GET")
api.HandleFunc("/tv/{id}", unifiedHandler.GetTV).Methods("GET")
api.HandleFunc("/search", unifiedHandler.Search).Methods("GET")
api.HandleFunc("/movies/{id}/recommendations", movieHandler.GetRecommendations).Methods("GET")
api.HandleFunc("/movies/{id}/similar", movieHandler.GetSimilar).Methods("GET")
api.HandleFunc("/movies/{id}/external-ids", movieHandler.GetExternalIDs).Methods("GET")