upd favorites

This commit is contained in:
2025-11-21 20:46:54 +02:00
parent 7b38988210
commit 5a4b6a9396
4 changed files with 377 additions and 268 deletions

View File

@@ -14,8 +14,9 @@ import (
)
type FavoritesService struct {
db *mongo.Database
tmdb *TMDBService
db *mongo.Database
tmdb *TMDBService
kinopoisk *KinopoiskService
}
func NewFavoritesService(db *mongo.Database, tmdb *TMDBService) *FavoritesService {
@@ -25,6 +26,14 @@ func NewFavoritesService(db *mongo.Database, tmdb *TMDBService) *FavoritesServic
}
}
func NewFavoritesServiceWithKP(db *mongo.Database, tmdb *TMDBService, kp *KinopoiskService) *FavoritesService {
return &FavoritesService{
db: db,
tmdb: tmdb,
kinopoisk: kp,
}
}
func (s *FavoritesService) AddToFavorites(userID, mediaID, mediaType string) error {
collection := s.db.Collection("favorites")