Added the ability to hide requests that have not been made by that user (#2052)

This commit is contained in:
Jamie 2018-03-09 09:28:45 +00:00 committed by GitHub
parent 28080fd8ab
commit 152818f8d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 284 additions and 52 deletions

View file

@ -33,6 +33,11 @@ namespace Ombi.Store.Repository.Requests
}
public IQueryable<MovieRequests> GetAll(string userId)
{
return GetWithUser().Where(x => x.RequestedUserId == userId);
}
public MovieRequests GetRequest(int theMovieDbId)
{
return Db.MovieRequests.Where(x => x.TheMovieDbId == theMovieDbId)
@ -48,6 +53,16 @@ namespace Ombi.Store.Repository.Requests
.AsQueryable();
}
public IQueryable<MovieRequests> GetWithUser(string userId)
{
return Db.MovieRequests
.Where(x => x.RequestedUserId == userId)
.Include(x => x.RequestedUser)
.ThenInclude(x => x.NotificationUserIds)
.AsQueryable();
}
public async Task Update(MovieRequests request)
{
if (Db.Entry(request).State == EntityState.Detached)