Remove provider status on provider deletion

(cherry picked from commit f45713bff815b2a49a5cdad4afe62a53bbdf6a6e)
pull/3725/head
Bogdan 5 months ago committed by bakerboy448
parent 84beba2383
commit 699b765ee9

@ -8,6 +8,7 @@ namespace NzbDrone.Core.ThingiProvider.Status
where TModel : ProviderStatusBase, new()
{
TModel FindByProviderId(int providerId);
void DeleteByProviderId(int providerId);
}
public class ProviderStatusRepository<TModel> : BasicRepository<TModel>, IProviderStatusRepository<TModel>
@ -22,5 +23,10 @@ namespace NzbDrone.Core.ThingiProvider.Status
{
return Query(c => c.ProviderId == providerId).SingleOrDefault();
}
public void DeleteByProviderId(int providerId)
{
Delete(c => c.ProviderId == providerId);
}
}
}

@ -151,12 +151,7 @@ namespace NzbDrone.Core.ThingiProvider.Status
public virtual void HandleAsync(ProviderDeletedEvent<TProvider> message)
{
var providerStatus = _providerStatusRepository.FindByProviderId(message.ProviderId);
if (providerStatus != null)
{
_providerStatusRepository.Delete(providerStatus);
}
_providerStatusRepository.DeleteByProviderId(message.ProviderId);
}
}
}

Loading…
Cancel
Save