Fixed #1583 you can now delete users.

Fixed the issue where the requested by was not showing.
Finally fixed the broken poster paths
This commit is contained in:
tidusjar 2017-10-20 22:07:30 +01:00
commit 1dc8eac035
27 changed files with 157 additions and 155 deletions

View file

@ -13,5 +13,6 @@ namespace Ombi.Core.Engine.Interfaces
RequestCountModel RequestCount();
Task<IEnumerable<T>> GetRequests(int count, int position);
Task<IEnumerable<T>> GetRequests();
Task<bool> UserHasRequest(string userId);
}
}

View file

@ -120,7 +120,10 @@ namespace Ombi.Core.Engine
public async Task<IEnumerable<MovieRequests>> GetRequests(int count, int position)
{
var allRequests = await MovieRepository.GetWithUser().Skip(position).Take(count).ToListAsync();
allRequests.ForEach(x => PosterPathHelper.FixPosterPath(x.PosterPath));
allRequests.ForEach(x =>
{
x.PosterPath = PosterPathHelper.FixPosterPath(x.PosterPath);
});
return allRequests;
}
@ -258,6 +261,11 @@ namespace Ombi.Core.Engine
await MovieRepository.Delete(request);
}
public async Task<bool> UserHasRequest(string userId)
{
return await MovieRepository.GetAll().AnyAsync(x => x.RequestedUserId == userId);
}
private async Task<RequestEngineResult> AddMovieRequest(MovieRequests model, string movieName)
{
await MovieRepository.Add(model);

View file

@ -242,6 +242,11 @@ namespace Ombi.Core.Engine
await TvRepository.Delete(request);
}
public async Task<bool> UserHasRequest(string userId)
{
return await TvRepository.GetChild().AnyAsync(x => x.RequestedUserId == userId);
}
private async Task<RequestEngineResult> AddExistingRequest(ChildRequests newRequest, TvRequests existingRequest)
{
// Add the child

View file

@ -6,7 +6,7 @@ namespace Ombi.Core.Models.UI
public class UserViewModel
{
public string Id { get; set; }
public string Username { get; set; }
public string UserName { get; set; }
public string Alias { get; set; }
public List<ClaimCheckboxes> Claims { get; set; }
public string EmailAddress { get; set; }

View file

@ -4,6 +4,7 @@ using Ombi.Core.Rule.Interfaces;
using Ombi.Store.Entities;
using Ombi.Store.Entities.Requests;
using Ombi.Store.Repository;
using Ombi.Store.Repository.Requests;
namespace Ombi.Core.Rule.Rules.Request
{