mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-20 21:33:15 -07:00
missed changes
This commit is contained in:
parent
e11ff49460
commit
65b2869ebe
3 changed files with 18 additions and 10 deletions
|
@ -26,6 +26,7 @@ namespace Ombi.Core.Engine
|
|||
private readonly IMusicRequestRepository _musicRepository;
|
||||
private readonly IRepository<Votes> _voteRepository;
|
||||
private readonly IRepository<MobileDevices> _mobileDevicesRepository;
|
||||
private readonly IRepository<PlexWatchlistUserError> _watchlistUserError;
|
||||
|
||||
public UserDeletionEngine(IMovieRequestRepository movieRepository,
|
||||
OmbiUserManager userManager,
|
||||
|
@ -39,7 +40,8 @@ namespace Ombi.Core.Engine
|
|||
IRepository<UserNotificationPreferences> notificationPreferencesRepo,
|
||||
IRepository<UserQualityProfiles> qualityProfilesRepo,
|
||||
IRepository<Votes> voteRepository,
|
||||
IRepository<MobileDevices> mobileDevicesRepository
|
||||
IRepository<MobileDevices> mobileDevicesRepository,
|
||||
IRepository<PlexWatchlistUserError> watchlistUserError
|
||||
)
|
||||
{
|
||||
_movieRepository = movieRepository;
|
||||
|
@ -56,6 +58,7 @@ namespace Ombi.Core.Engine
|
|||
_userQualityProfiles = qualityProfilesRepo;
|
||||
_voteRepository = voteRepository;
|
||||
_mobileDevicesRepository = mobileDevicesRepository;
|
||||
_watchlistUserError = watchlistUserError;
|
||||
}
|
||||
|
||||
|
||||
|
@ -68,6 +71,7 @@ namespace Ombi.Core.Engine
|
|||
var musicRequested = _musicRepository.GetAll().Where(x => x.RequestedUserId == userId);
|
||||
var notificationPreferences = _userNotificationPreferences.GetAll().Where(x => x.UserId == userId);
|
||||
var userQuality = await _userQualityProfiles.GetAll().FirstOrDefaultAsync(x => x.UserId == userId);
|
||||
var watchlistError = await _watchlistUserError.GetAll().FirstOrDefaultAsync(x => x.UserId == userId);
|
||||
|
||||
if (moviesUserRequested.Any())
|
||||
{
|
||||
|
@ -89,6 +93,10 @@ namespace Ombi.Core.Engine
|
|||
{
|
||||
await _userQualityProfiles.Delete(userQuality);
|
||||
}
|
||||
if (watchlistError != null)
|
||||
{
|
||||
await _watchlistUserError.Delete(watchlistError);
|
||||
}
|
||||
|
||||
// Delete any issues and request logs
|
||||
var issues = _issuesRepository.GetAll().Where(x => x.UserReportedId == userId);
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace Ombi.Schedule.Tests
|
|||
_context = _mocker.GetMock<IJobExecutionContext>();
|
||||
_context.Setup(x => x.CancellationToken).Returns(CancellationToken.None);
|
||||
_subject = _mocker.CreateInstance<PlexWatchlistImport>();
|
||||
_mocker.Setup<IExternalRepository<PlexWatchlistUserError>, IQueryable<PlexWatchlistUserError>>(x => x.GetAll()).Returns(new List<PlexWatchlistUserError>().AsQueryable().BuildMock().Object);
|
||||
_mocker.Setup<IRepository<PlexWatchlistUserError>, IQueryable<PlexWatchlistUserError>>(x => x.GetAll()).Returns(new List<PlexWatchlistUserError>().AsQueryable().BuildMock().Object);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -90,8 +90,8 @@ namespace Ombi.Schedule.Tests
|
|||
_mocker.Verify<IPlexApi>(x => x.GetWatchlist(It.IsAny<string>(), It.IsAny<CancellationToken>()), Times.Once);
|
||||
_mocker.Verify<IMovieRequestEngine>(x => x.RequestMovie(It.IsAny<MovieRequestViewModel>()), Times.Never);
|
||||
_mocker.Verify<IExternalRepository<PlexWatchlistHistory>>(x => x.GetAll(), Times.Never);
|
||||
_mocker.Verify<IExternalRepository<PlexWatchlistHistory>>(x => x.Add(It.IsAny<PlexWatchlistHistory>()), Times.Never);
|
||||
_mocker.Verify<IExternalRepository<PlexWatchlistUserError>>(x => x.Add(It.Is<PlexWatchlistUserError>(x => x.UserId == "abc")), Times.Once);
|
||||
_mocker.Verify<IRepository<PlexWatchlistHistory>>(x => x.Add(It.IsAny<PlexWatchlistHistory>()), Times.Never);
|
||||
_mocker.Verify<IRepository<PlexWatchlistUserError>>(x => x.Add(It.Is<PlexWatchlistUserError>(x => x.UserId == "abc")), Times.Once);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -114,8 +114,8 @@ namespace Ombi.Schedule.Tests
|
|||
_mocker.Verify<IMovieRequestEngine>(x => x.RequestMovie(It.IsAny<MovieRequestViewModel>()), Times.Never);
|
||||
_mocker.Verify<IExternalRepository<PlexWatchlistHistory>>(x => x.GetAll(), Times.Never);
|
||||
_mocker.Verify<IExternalRepository<PlexWatchlistHistory>>(x => x.Add(It.IsAny<PlexWatchlistHistory>()), Times.Never);
|
||||
_mocker.Verify<IExternalRepository<PlexWatchlistUserError>>(x => x.Add(It.Is<PlexWatchlistUserError>(x => x.UserId == "abc")), Times.Never);
|
||||
_mocker.Verify<IExternalRepository<PlexWatchlistUserError>>(x => x.Delete(It.Is<PlexWatchlistUserError>(x => x.UserId == "abc")), Times.Once);
|
||||
_mocker.Verify<IRepository<PlexWatchlistUserError>>(x => x.Add(It.Is<PlexWatchlistUserError>(x => x.UserId == "abc")), Times.Never);
|
||||
_mocker.Verify<IRepository<PlexWatchlistUserError>>(x => x.Delete(It.Is<PlexWatchlistUserError>(x => x.UserId == "abc")), Times.Once);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -138,8 +138,8 @@ namespace Ombi.Schedule.Tests
|
|||
_mocker.Verify<IMovieRequestEngine>(x => x.RequestMovie(It.IsAny<MovieRequestViewModel>()), Times.Never);
|
||||
_mocker.Verify<IExternalRepository<PlexWatchlistHistory>>(x => x.GetAll(), Times.Never);
|
||||
_mocker.Verify<IExternalRepository<PlexWatchlistHistory>>(x => x.Add(It.IsAny<PlexWatchlistHistory>()), Times.Never);
|
||||
_mocker.Verify<IExternalRepository<PlexWatchlistUserError>>(x => x.Add(It.Is<PlexWatchlistUserError>(x => x.UserId == "abc")), Times.Never);
|
||||
_mocker.Verify<IExternalRepository<PlexWatchlistUserError>>(x => x.Delete(It.Is<PlexWatchlistUserError>(x => x.UserId == "abc")), Times.Never);
|
||||
_mocker.Verify<IRepository<PlexWatchlistUserError>>(x => x.Add(It.Is<PlexWatchlistUserError>(x => x.UserId == "abc")), Times.Never);
|
||||
_mocker.Verify<IRepository<PlexWatchlistUserError>>(x => x.Delete(It.Is<PlexWatchlistUserError>(x => x.UserId == "abc")), Times.Never);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -33,11 +33,11 @@ namespace Ombi.Schedule.Jobs.Plex
|
|||
private readonly IHubContext<NotificationHub> _hub;
|
||||
private readonly ILogger _logger;
|
||||
private readonly IExternalRepository<PlexWatchlistHistory> _watchlistRepo;
|
||||
private readonly IExternalRepository<PlexWatchlistUserError> _userError;
|
||||
private readonly IRepository<PlexWatchlistUserError> _userError;
|
||||
|
||||
public PlexWatchlistImport(IPlexApi plexApi, ISettingsService<PlexSettings> settings, OmbiUserManager ombiUserManager,
|
||||
IMovieRequestEngine movieRequestEngine, ITvRequestEngine tvRequestEngine, IHubContext<NotificationHub> hub,
|
||||
ILogger<PlexWatchlistImport> logger, IExternalRepository<PlexWatchlistHistory> watchlistRepo, IExternalRepository<PlexWatchlistUserError> userError)
|
||||
ILogger<PlexWatchlistImport> logger, IExternalRepository<PlexWatchlistHistory> watchlistRepo, IRepository<PlexWatchlistUserError> userError)
|
||||
{
|
||||
_plexApi = plexApi;
|
||||
_settings = settings;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue