mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-12 08:16:05 -07:00
Finished adding subscriptions for TV Shows
This commit is contained in:
parent
7a9fc1213f
commit
16952cb44c
11 changed files with 95 additions and 29 deletions
|
@ -138,10 +138,10 @@ namespace Ombi.Core.Engine
|
|||
{
|
||||
allRequests = await MovieRepository.GetWithUser().Skip(position).Take(count).OrderByDescending(x => x.ReleaseDate).ToListAsync();
|
||||
}
|
||||
allRequests.ForEach(x =>
|
||||
allRequests.ForEach(async x =>
|
||||
{
|
||||
x.PosterPath = PosterPathHelper.FixPosterPath(x.PosterPath);
|
||||
CheckForSubscription(shouldHide, x);
|
||||
await CheckForSubscription(shouldHide, x);
|
||||
});
|
||||
return allRequests;
|
||||
}
|
||||
|
@ -176,19 +176,27 @@ namespace Ombi.Core.Engine
|
|||
allRequests = await MovieRepository.GetWithUser().ToListAsync();
|
||||
}
|
||||
|
||||
allRequests.ForEach(x =>
|
||||
allRequests.ForEach(async x =>
|
||||
{
|
||||
x.PosterPath = PosterPathHelper.FixPosterPath(x.PosterPath);
|
||||
CheckForSubscription(shouldHide, x);
|
||||
await CheckForSubscription(shouldHide, x);
|
||||
});
|
||||
return allRequests;
|
||||
}
|
||||
|
||||
private void CheckForSubscription(HideResult shouldHide, MovieRequests x)
|
||||
private async Task CheckForSubscription(HideResult shouldHide, MovieRequests x)
|
||||
{
|
||||
var sub = _subscriptionRepository.GetAll().FirstOrDefaultAsync(s =>
|
||||
s.UserId == shouldHide.UserId && s.RequestId == x.Id && s.RequestType == RequestType.Movie);
|
||||
x.Subscribed = sub != null;
|
||||
if (shouldHide.UserId == x.RequestedUserId)
|
||||
{
|
||||
x.ShowSubscribe = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
x.ShowSubscribe = true;
|
||||
var sub = await _subscriptionRepository.GetAll().FirstOrDefaultAsync(s =>
|
||||
s.UserId == shouldHide.UserId && s.RequestId == x.Id && s.RequestType == RequestType.Movie);
|
||||
x.Subscribed = sub != null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -209,10 +217,10 @@ namespace Ombi.Core.Engine
|
|||
allRequests = await MovieRepository.GetWithUser().ToListAsync();
|
||||
}
|
||||
var results = allRequests.Where(x => x.Title.Contains(search, CompareOptions.IgnoreCase)).ToList();
|
||||
results.ForEach(x =>
|
||||
results.ForEach(async x =>
|
||||
{
|
||||
x.PosterPath = PosterPathHelper.FixPosterPath(x.PosterPath);
|
||||
CheckForSubscription(shouldHide, x);
|
||||
await CheckForSubscription(shouldHide, x);
|
||||
});
|
||||
return results;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue