mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 02:26:55 -07:00
This commit is contained in:
parent
385d206287
commit
3cc45b3022
30 changed files with 317 additions and 126 deletions
|
@ -53,6 +53,7 @@ namespace Ombi.Store.Entities
|
|||
/// </summary>
|
||||
public int Key { get; set; }
|
||||
public DateTime AddedAt { get; set; }
|
||||
public string Quality { get; set; }
|
||||
}
|
||||
|
||||
[Table("PlexSeasonsContent")]
|
||||
|
|
|
@ -10,7 +10,7 @@ using Ombi.Helpers;
|
|||
namespace Ombi.Store.Migrations
|
||||
{
|
||||
[DbContext(typeof(OmbiContext))]
|
||||
[Migration("20170824133349_Inital")]
|
||||
[Migration("20170825114646_Inital")]
|
||||
partial class Inital
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
|
@ -258,6 +258,8 @@ namespace Ombi.Store.Migrations
|
|||
|
||||
b.Property<string>("ProviderId");
|
||||
|
||||
b.Property<string>("Quality");
|
||||
|
||||
b.Property<string>("ReleaseYear");
|
||||
|
||||
b.Property<string>("Title");
|
|
@ -134,6 +134,7 @@ namespace Ombi.Store.Migrations
|
|||
AddedAt = table.Column<DateTime>(nullable: false),
|
||||
Key = table.Column<int>(nullable: false),
|
||||
ProviderId = table.Column<string>(nullable: true),
|
||||
Quality = table.Column<string>(nullable: true),
|
||||
ReleaseYear = table.Column<string>(nullable: true),
|
||||
Title = table.Column<string>(nullable: true),
|
||||
Type = table.Column<int>(nullable: false),
|
|
@ -257,6 +257,8 @@ namespace Ombi.Store.Migrations
|
|||
|
||||
b.Property<string>("ProviderId");
|
||||
|
||||
b.Property<string>("Quality");
|
||||
|
||||
b.Property<string>("ReleaseYear");
|
||||
|
||||
b.Property<string>("Title");
|
||||
|
|
|
@ -9,7 +9,8 @@ namespace Ombi.Store.Repository
|
|||
Task<MovieRequests> Add(MovieRequests request);
|
||||
Task Delete(MovieRequests request);
|
||||
IQueryable<MovieRequests> Get();
|
||||
Task<MovieRequests> GetRequest(int theMovieDbId);
|
||||
Task<MovieRequests> GetRequestAsync(int theMovieDbId);
|
||||
MovieRequests GetRequest(int theMovieDbId);
|
||||
Task Update(MovieRequests request);
|
||||
Task Save();
|
||||
}
|
||||
|
|
|
@ -11,7 +11,8 @@ namespace Ombi.Store.Repository.Requests
|
|||
Task Delete(TvRequests request);
|
||||
Task DeleteChild(ChildRequests request);
|
||||
IQueryable<TvRequests> Get();
|
||||
Task<TvRequests> GetRequest(int tvDbId);
|
||||
Task<TvRequests> GetRequestAsync(int tvDbId);
|
||||
TvRequests GetRequest(int tvDbId);
|
||||
Task Update(TvRequests request);
|
||||
Task UpdateChild(ChildRequests request);
|
||||
IQueryable<ChildRequests> GetChild();
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
@ -16,11 +17,27 @@ namespace Ombi.Store.Repository.Requests
|
|||
|
||||
private IOmbiContext Db { get; }
|
||||
|
||||
public async Task<MovieRequests> GetRequest(int theMovieDbId)
|
||||
public async Task<MovieRequests> GetRequestAsync(int theMovieDbId)
|
||||
{
|
||||
return await Db.MovieRequests.Where(x => x.TheMovieDbId == theMovieDbId)
|
||||
try
|
||||
{
|
||||
return await Db.MovieRequests.Where(x => x.TheMovieDbId == theMovieDbId)
|
||||
.Include(x => x.RequestedUser)
|
||||
.FirstOrDefaultAsync();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public MovieRequests GetRequest(int theMovieDbId)
|
||||
{
|
||||
return Db.MovieRequests.Where(x => x.TheMovieDbId == theMovieDbId)
|
||||
.Include(x => x.RequestedUser)
|
||||
.FirstOrDefaultAsync();
|
||||
.FirstOrDefault();
|
||||
}
|
||||
|
||||
public IQueryable<MovieRequests> Get()
|
||||
|
|
|
@ -15,17 +15,28 @@ namespace Ombi.Store.Repository.Requests
|
|||
|
||||
private IOmbiContext Db { get; }
|
||||
|
||||
public async Task<TvRequests> GetRequest(int tvDbId)
|
||||
public async Task<TvRequests> GetRequestAsync(int tvDbId)
|
||||
{
|
||||
return await Db.TvRequests.Where(x => x.TvDbId == tvDbId)
|
||||
.Include(x => x.ChildRequests)
|
||||
.ThenInclude(x => x.RequestedUser)
|
||||
.ThenInclude(x => x.RequestedUser)
|
||||
.Include(x => x.ChildRequests)
|
||||
.ThenInclude(x => x.SeasonRequests)
|
||||
.ThenInclude(x => x.Episodes)
|
||||
.FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public TvRequests GetRequest(int tvDbId)
|
||||
{
|
||||
return Db.TvRequests.Where(x => x.TvDbId == tvDbId)
|
||||
.Include(x => x.ChildRequests)
|
||||
.ThenInclude(x => x.RequestedUser)
|
||||
.Include(x => x.ChildRequests)
|
||||
.ThenInclude(x => x.SeasonRequests)
|
||||
.ThenInclude(x => x.Episodes)
|
||||
.FirstOrDefault();
|
||||
}
|
||||
|
||||
public IQueryable<TvRequests> Get()
|
||||
{
|
||||
return Db.TvRequests
|
||||
|
@ -40,6 +51,7 @@ namespace Ombi.Store.Repository.Requests
|
|||
{
|
||||
return Db.ChildRequests
|
||||
.Include(x => x.RequestedUser)
|
||||
.Include(x => x.ParentRequest)
|
||||
.Include(x => x.SeasonRequests)
|
||||
.ThenInclude(x => x.Episodes)
|
||||
.AsQueryable();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue