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

@ -48,6 +48,18 @@ namespace Ombi.Store.Repository.Requests
.ThenInclude(x => x.Episodes)
.AsQueryable();
}
public IQueryable<TvRequests> Get(string userId)
{
return Db.TvRequests
.Include(x => x.ChildRequests)
.ThenInclude(x => x.RequestedUser)
.Include(x => x.ChildRequests)
.ThenInclude(x => x.SeasonRequests)
.ThenInclude(x => x.Episodes)
.Where(x => x.ChildRequests.Any(a => a.RequestedUserId == userId))
.AsQueryable();
}
public IQueryable<ChildRequests> GetChild()
{
return Db.ChildRequests
@ -58,6 +70,17 @@ namespace Ombi.Store.Repository.Requests
.AsQueryable();
}
public IQueryable<ChildRequests> GetChild(string userId)
{
return Db.ChildRequests
.Where(x => x.RequestedUserId == userId)
.Include(x => x.RequestedUser)
.Include(x => x.ParentRequest)
.Include(x => x.SeasonRequests)
.ThenInclude(x => x.Episodes)
.AsQueryable();
}
public async Task Save()
{
await Db.SaveChangesAsync();