mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-09 03:04:20 -04:00
Adding a 'fields' query param to every requests to load related data
This commit is contained in:
parent
49f0ab8bfa
commit
97ab1affa0
@ -61,14 +61,19 @@ namespace Kyoo.Controllers
|
|||||||
Task<Studio> GetStudio(Expression<Func<Studio, bool>> where);
|
Task<Studio> GetStudio(Expression<Func<Studio, bool>> where);
|
||||||
Task<People> GetPerson(Expression<Func<People, bool>> where);
|
Task<People> GetPerson(Expression<Func<People, bool>> where);
|
||||||
|
|
||||||
Task Load<T, T2>([NotNull] T obj, [CanBeNull] Expression<Func<T, T2>> member)
|
Task<T> Load<T, T2>([NotNull] T obj, Expression<Func<T, T2>> member)
|
||||||
where T : class, IResource
|
where T : class, IResource
|
||||||
where T2 : class, IResource, new();
|
where T2 : class, IResource, new();
|
||||||
|
|
||||||
Task Load<T, T2>([NotNull] T obj, [CanBeNull] Expression<Func<T, ICollection<T2>>> member)
|
Task<T> Load<T, T2>([NotNull] T obj, Expression<Func<T, ICollection<T2>>> member)
|
||||||
where T : class, IResource
|
where T : class, IResource
|
||||||
where T2 : class, new();
|
where T2 : class, new();
|
||||||
|
|
||||||
|
Task<T> Load<T>(T obj, string memberName)
|
||||||
|
where T : class, IResource;
|
||||||
|
|
||||||
|
Task Load(IResource obj, string memberName);
|
||||||
|
|
||||||
// Library Items relations
|
// Library Items relations
|
||||||
Task<ICollection<LibraryItem>> GetItemsFromLibrary(int id,
|
Task<ICollection<LibraryItem>> GetItemsFromLibrary(int id,
|
||||||
Expression<Func<LibraryItem, bool>> where = null,
|
Expression<Func<LibraryItem, bool>> where = null,
|
||||||
|
@ -236,83 +236,117 @@ namespace Kyoo.Controllers
|
|||||||
return PeopleRepository.Get(where);
|
return PeopleRepository.Get(where);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task Load<T, T2>(T obj, Expression<Func<T, T2>> member)
|
public Task<T> Load<T, T2>(T obj, Expression<Func<T, T2>> member)
|
||||||
where T : class, IResource
|
where T : class, IResource
|
||||||
where T2 : class, IResource, new()
|
where T2 : class, IResource, new()
|
||||||
{
|
{
|
||||||
return (obj, new T2()) switch
|
if (member == null)
|
||||||
{
|
throw new ArgumentNullException(nameof(member));
|
||||||
(Show s, Studio) => StudioRepository.Get(x => x.Shows.Any(Utility.ResourceEqualsFunc<Show>(obj)))
|
return Load(obj, Utility.GetPropertyName(member));
|
||||||
.Then(x => s.Studio = x),
|
|
||||||
|
|
||||||
(Season s, Show) => ShowRepository.Get(Utility.ResourceEquals<Show>(obj)).Then(x => s.Show = x),
|
|
||||||
|
|
||||||
(Episode e, Show) => ShowRepository.Get(Utility.ResourceEquals<Show>(obj)).Then(x => e.Show = x),
|
|
||||||
(Episode e, Season) => SeasonRepository.Get(Utility.ResourceEquals<Season>(obj))
|
|
||||||
.Then(x => e.Season = x),
|
|
||||||
|
|
||||||
(Track t, Episode) => EpisodeRepository.Get(Utility.ResourceEquals<Episode>(obj))
|
|
||||||
.Then(x => t.Episode = x),
|
|
||||||
|
|
||||||
_ => throw new ArgumentException($"Couldn't find a way to load {member} of {typeof(T).Name}.")
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task Load<T, T2>(T obj, Expression<Func<T, ICollection<T2>>> member)
|
public Task<T> Load<T, T2>(T obj, Expression<Func<T, ICollection<T2>>> member)
|
||||||
where T : class, IResource
|
where T : class, IResource
|
||||||
where T2 : class, new()
|
where T2 : class, new()
|
||||||
{
|
{
|
||||||
return (obj, new T2()) switch
|
if (member == null)
|
||||||
|
throw new ArgumentNullException(nameof(member));
|
||||||
|
return Load(obj, Utility.GetPropertyName(member));
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<T> Load<T>(T obj, string member)
|
||||||
|
where T : class, IResource
|
||||||
|
{
|
||||||
|
await Load(obj as IResource, member);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task Load(IResource obj, string member)
|
||||||
|
{
|
||||||
|
return (obj, member) switch
|
||||||
{
|
{
|
||||||
(Library l, ProviderID) => ProviderRepository.GetAll(Utility.ResourceEquals<ProviderID>(obj))
|
(Library l, nameof(Library.Providers)) => ProviderRepository
|
||||||
|
.GetAll(Utility.ResourceEquals<ProviderID>(obj))
|
||||||
.Then(x => l.Providers = x),
|
.Then(x => l.Providers = x),
|
||||||
(Library l, Show) => ShowRepository.GetAll(Utility.ResourceEquals<Show>(obj))
|
(Library l, nameof(Library.Shows)) => ShowRepository.GetAll(Utility.ResourceEquals<Show>(obj))
|
||||||
.Then(x => l.Shows = x),
|
.Then(x => l.Shows = x),
|
||||||
(Library l, Collection) => CollectionRepository.GetAll(Utility.ResourceEquals<Collection>(obj))
|
(Library l, nameof(Library.Collections)) => CollectionRepository
|
||||||
|
.GetAll(Utility.ResourceEquals<Collection>(obj))
|
||||||
.Then(x => l.Collections = x),
|
.Then(x => l.Collections = x),
|
||||||
|
|
||||||
(Collection c, Show) => ShowRepository.GetAll(Utility.ResourceEquals<Show>(obj))
|
(Collection c, nameof(Library.Shows)) => ShowRepository
|
||||||
|
.GetAll(Utility.ResourceEquals<Show>(obj))
|
||||||
.Then(x => c.Shows = x),
|
.Then(x => c.Shows = x),
|
||||||
(Collection c, Library) => LibraryRepository.GetAll(Utility.ResourceEquals<Library>(obj))
|
(Collection c, nameof(Collection.Libraries)) => LibraryRepository
|
||||||
|
.GetAll(Utility.ResourceEquals<Library>(obj))
|
||||||
.Then(x => c.Libraries = x),
|
.Then(x => c.Libraries = x),
|
||||||
|
|
||||||
(Show s, MetadataID) => ProviderRepository.GetMetadataID(x => x.ShowID == obj.ID)
|
(Show s, nameof(Show.ExternalIDs)) => ProviderRepository
|
||||||
|
.GetMetadataID(x => x.ShowID == obj.ID)
|
||||||
.Then(x => s.ExternalIDs = x),
|
.Then(x => s.ExternalIDs = x),
|
||||||
(Show s, Genre) => GenreRepository.GetAll(Utility.ResourceEquals<Genre>(obj))
|
(Show s, nameof(Show.Genres)) => GenreRepository
|
||||||
|
.GetAll(Utility.ResourceEquals<Genre>(obj))
|
||||||
.Then(x => s.Genres = x),
|
.Then(x => s.Genres = x),
|
||||||
(Show s, PeopleRole) => (PeopleRepository.GetFromShow((dynamic)(obj.ID > 0 ? obj.ID : obj.Slug))
|
(Show s, nameof(Show.People)) => (
|
||||||
|
PeopleRepository.GetFromShow((dynamic)(obj.ID > 0 ? obj.ID : obj.Slug))
|
||||||
as Task<ICollection<PeopleRole>>).Then(x => s.People = x),
|
as Task<ICollection<PeopleRole>>).Then(x => s.People = x),
|
||||||
(Show s, Season) => SeasonRepository.GetAll(Utility.ResourceEquals<Season>(obj))
|
(Show s, nameof(Show.Seasons)) => SeasonRepository
|
||||||
|
.GetAll(Utility.ResourceEquals<Season>(obj))
|
||||||
.Then(x => s.Seasons = x),
|
.Then(x => s.Seasons = x),
|
||||||
(Show s, Episode) => EpisodeRepository.GetAll(Utility.ResourceEquals<Episode>(obj))
|
(Show s, nameof(Show.Episodes)) => EpisodeRepository
|
||||||
|
.GetAll(Utility.ResourceEquals<Episode>(obj))
|
||||||
.Then(x => s.Episodes = x),
|
.Then(x => s.Episodes = x),
|
||||||
(Show s, Library) => LibraryRepository.GetAll(Utility.ResourceEquals<Library>(obj))
|
(Show s, nameof(Show.Libraries)) => LibraryRepository
|
||||||
|
.GetAll(Utility.ResourceEquals<Library>(obj))
|
||||||
.Then(x => s.Libraries = x),
|
.Then(x => s.Libraries = x),
|
||||||
(Show s, Collection) => CollectionRepository.GetAll(Utility.ResourceEquals<Collection>(obj))
|
(Show s, nameof(Show.Collections)) => CollectionRepository
|
||||||
|
.GetAll(Utility.ResourceEquals<Collection>(obj))
|
||||||
.Then(x => s.Collections = x),
|
.Then(x => s.Collections = x),
|
||||||
|
(Show s, nameof(Show.Studio)) => StudioRepository
|
||||||
|
.Get(x => x.Shows.Any(Utility.ResourceEqualsFunc<Show>(obj)))
|
||||||
|
.Then(x => s.Studio = x),
|
||||||
|
|
||||||
(Season s, MetadataID) => ProviderRepository.GetMetadataID(x => x.SeasonID == obj.ID)
|
(Season s, nameof(Season.ExternalIDs)) => ProviderRepository
|
||||||
|
.GetMetadataID(x => x.SeasonID == obj.ID)
|
||||||
.Then(x => s.ExternalIDs = x),
|
.Then(x => s.ExternalIDs = x),
|
||||||
(Season s, Episode) => EpisodeRepository.GetAll(Utility.ResourceEquals<Episode>(obj))
|
(Season s, nameof(Season.Episodes)) => EpisodeRepository
|
||||||
|
.GetAll(Utility.ResourceEquals<Episode>(obj))
|
||||||
.Then(x => s.Episodes = x),
|
.Then(x => s.Episodes = x),
|
||||||
|
(Season s, nameof(Season.Show)) => ShowRepository
|
||||||
|
.Get(Utility.ResourceEquals<Show>(obj)).Then(x => s.Show = x),
|
||||||
|
|
||||||
(Episode e, MetadataID) => ProviderRepository.GetMetadataID(x => x.EpisodeID == obj.ID)
|
(Episode e, nameof(Episode.ExternalIDs)) => ProviderRepository
|
||||||
|
.GetMetadataID(x => x.EpisodeID == obj.ID)
|
||||||
.Then(x => e.ExternalIDs = x),
|
.Then(x => e.ExternalIDs = x),
|
||||||
(Episode e, Track) => TrackRepository.GetAll(Utility.ResourceEquals<Track>(obj))
|
(Episode e, nameof(Episode.Tracks)) => TrackRepository
|
||||||
|
.GetAll(Utility.ResourceEquals<Track>(obj))
|
||||||
.Then(x => e.Tracks = x),
|
.Then(x => e.Tracks = x),
|
||||||
|
(Episode e, nameof(Episode.Show)) => ShowRepository
|
||||||
|
.Get(Utility.ResourceEquals<Show>(obj)).Then(x => e.Show = x),
|
||||||
|
(Episode e, nameof(Episode.Season)) => SeasonRepository
|
||||||
|
.Get(Utility.ResourceEquals<Season>(obj))
|
||||||
|
.Then(x => e.Season = x),
|
||||||
|
|
||||||
(Genre g, Show) => ShowRepository.GetAll(Utility.ResourceEquals<Show>(obj))
|
(Track t, nameof(Track.Episode)) => EpisodeRepository
|
||||||
|
.Get(Utility.ResourceEquals<Episode>(obj))
|
||||||
|
.Then(x => t.Episode = x),
|
||||||
|
|
||||||
|
(Genre g, nameof(Genre.Shows)) => ShowRepository
|
||||||
|
.GetAll(Utility.ResourceEquals<Show>(obj))
|
||||||
.Then(x => g.Shows = x),
|
.Then(x => g.Shows = x),
|
||||||
|
|
||||||
(Studio s, Show) => ShowRepository.GetAll(Utility.ResourceEquals<Show>(obj))
|
(Studio s, nameof(Studio.Shows)) => ShowRepository
|
||||||
|
.GetAll(Utility.ResourceEquals<Show>(obj))
|
||||||
.Then(x => s.Shows = x),
|
.Then(x => s.Shows = x),
|
||||||
|
|
||||||
(People p, MetadataID) => ProviderRepository.GetMetadataID(x => x.PeopleID == obj.ID)
|
(People p, nameof(People.ExternalIDs)) => ProviderRepository
|
||||||
|
.GetMetadataID(x => x.PeopleID == obj.ID)
|
||||||
.Then(x => p.ExternalIDs = x),
|
.Then(x => p.ExternalIDs = x),
|
||||||
(People p, PeopleRole) => (PeopleRepository.GetFromPeople((dynamic)(obj.ID > 0 ? obj.ID : obj.Slug))
|
(People p, nameof(People.Roles)) => (
|
||||||
|
PeopleRepository.GetFromPeople((dynamic)(obj.ID > 0 ? obj.ID : obj.Slug))
|
||||||
as Task<ICollection<PeopleRole>>).Then(x => p.Roles = x),
|
as Task<ICollection<PeopleRole>>).Then(x => p.Roles = x),
|
||||||
|
|
||||||
_ => throw new ArgumentException($"Couldn't find a way to load {member} of {typeof(T).Name}.")
|
_ => throw new ArgumentException($"Couldn't find a way to load {member} of {obj.Slug}.")
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,6 +24,16 @@ namespace Kyoo
|
|||||||
ex.Body.NodeType == ExpressionType.Convert && ((UnaryExpression)ex.Body).Operand is MemberExpression;
|
ex.Body.NodeType == ExpressionType.Convert && ((UnaryExpression)ex.Body).Operand is MemberExpression;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string GetPropertyName(LambdaExpression ex)
|
||||||
|
{
|
||||||
|
if (!IsPropertyExpression(ex))
|
||||||
|
throw new ArgumentException($"{ex} is not a property expression.");
|
||||||
|
MemberExpression member = ex.Body.NodeType == ExpressionType.Convert
|
||||||
|
? ((UnaryExpression)ex.Body).Operand as MemberExpression
|
||||||
|
: ex.Body as MemberExpression;
|
||||||
|
return member!.Member.Name;
|
||||||
|
}
|
||||||
|
|
||||||
public static string ToSlug(string str)
|
public static string ToSlug(string str)
|
||||||
{
|
{
|
||||||
if (str == null)
|
if (str == null)
|
||||||
@ -32,7 +42,7 @@ namespace Kyoo
|
|||||||
str = str.ToLowerInvariant();
|
str = str.ToLowerInvariant();
|
||||||
|
|
||||||
string normalizedString = str.Normalize(NormalizationForm.FormD);
|
string normalizedString = str.Normalize(NormalizationForm.FormD);
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
StringBuilder stringBuilder = new();
|
||||||
foreach (char c in normalizedString)
|
foreach (char c in normalizedString)
|
||||||
{
|
{
|
||||||
UnicodeCategory unicodeCategory = CharUnicodeInfo.GetUnicodeCategory(c);
|
UnicodeCategory unicodeCategory = CharUnicodeInfo.GetUnicodeCategory(c);
|
||||||
@ -238,10 +248,12 @@ namespace Kyoo
|
|||||||
action();
|
action();
|
||||||
yield break;
|
yield break;
|
||||||
}
|
}
|
||||||
|
|
||||||
yield return enumerator.Current;
|
do
|
||||||
while (enumerator.MoveNext())
|
{
|
||||||
yield return enumerator.Current;
|
yield return enumerator.Current;
|
||||||
|
}
|
||||||
|
while (enumerator.MoveNext());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static MethodInfo GetMethod(Type type, BindingFlags flag, string name, Type[] generics, object[] args)
|
private static MethodInfo GetMethod(Type type, BindingFlags flag, string name, Type[] generics, object[] args)
|
||||||
|
@ -12,6 +12,7 @@ using Microsoft.Extensions.Configuration;
|
|||||||
namespace Kyoo.CommonApi
|
namespace Kyoo.CommonApi
|
||||||
{
|
{
|
||||||
[ApiController]
|
[ApiController]
|
||||||
|
[ResourceView]
|
||||||
public class CrudApi<T> : ControllerBase where T : class, IResource
|
public class CrudApi<T> : ControllerBase where T : class, IResource
|
||||||
{
|
{
|
||||||
private readonly IRepository<T> _repository;
|
private readonly IRepository<T> _repository;
|
||||||
@ -22,7 +23,8 @@ namespace Kyoo.CommonApi
|
|||||||
_repository = repository;
|
_repository = repository;
|
||||||
BaseURL = configuration.GetValue<string>("public_url").TrimEnd('/');
|
BaseURL = configuration.GetValue<string>("public_url").TrimEnd('/');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[HttpGet("{id:int}")]
|
[HttpGet("{id:int}")]
|
||||||
[Authorize(Policy = "Read")]
|
[Authorize(Policy = "Read")]
|
||||||
[JsonDetailed]
|
[JsonDetailed]
|
||||||
@ -68,10 +70,6 @@ namespace Kyoo.CommonApi
|
|||||||
[FromQuery] Dictionary<string, string> where,
|
[FromQuery] Dictionary<string, string> where,
|
||||||
[FromQuery] int limit = 20)
|
[FromQuery] int limit = 20)
|
||||||
{
|
{
|
||||||
where.Remove("sortBy");
|
|
||||||
where.Remove("limit");
|
|
||||||
where.Remove("afterID");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ICollection<T> resources = await _repository.GetAll(ApiHelper.ParseWhere<T>(where),
|
ICollection<T> resources = await _repository.GetAll(ApiHelper.ParseWhere<T>(where),
|
||||||
@ -89,7 +87,7 @@ namespace Kyoo.CommonApi
|
|||||||
protected Page<TResult> Page<TResult>(ICollection<TResult> resources, int limit)
|
protected Page<TResult> Page<TResult>(ICollection<TResult> resources, int limit)
|
||||||
where TResult : IResource
|
where TResult : IResource
|
||||||
{
|
{
|
||||||
return new Page<TResult>(resources,
|
return new(resources,
|
||||||
BaseURL + Request.Path,
|
BaseURL + Request.Path,
|
||||||
Request.Query.ToDictionary(x => x.Key, x => x.Value.ToString(), StringComparer.InvariantCultureIgnoreCase),
|
Request.Query.ToDictionary(x => x.Key, x => x.Value.ToString(), StringComparer.InvariantCultureIgnoreCase),
|
||||||
limit);
|
limit);
|
||||||
|
60
Kyoo.CommonAPI/ResourceViewAttribute.cs
Normal file
60
Kyoo.CommonAPI/ResourceViewAttribute.cs
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Kyoo.Controllers;
|
||||||
|
using Kyoo.Models;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Filters;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
|
namespace Kyoo.CommonApi
|
||||||
|
{
|
||||||
|
public class ResourceViewAttribute : ActionFilterAttribute
|
||||||
|
{
|
||||||
|
public override void OnActionExecuting(ActionExecutingContext context)
|
||||||
|
{
|
||||||
|
if (context.ActionArguments.TryGetValue("where", out object dic) && dic is Dictionary<string, string> where)
|
||||||
|
{
|
||||||
|
where.Remove("fields");
|
||||||
|
foreach ((string key, _) in context.ActionArguments)
|
||||||
|
where.Remove(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
context.HttpContext.Items["fields"] = context.HttpContext.Request.Query["fields"].ToArray();
|
||||||
|
// TODO Check if fields are loadable properties of the return type. If not, shorfail the request.
|
||||||
|
base.OnActionExecuting(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task OnResultExecutionAsync(ResultExecutingContext context, ResultExecutionDelegate next)
|
||||||
|
{
|
||||||
|
if (context.Result is ObjectResult result)
|
||||||
|
await LoadResultRelations(context, result);
|
||||||
|
await base.OnResultExecutionAsync(context, next);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static async Task LoadResultRelations(ActionContext context, ObjectResult result)
|
||||||
|
{
|
||||||
|
if (result.DeclaredType == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
await using ILibraryManager library = context.HttpContext.RequestServices.GetService<ILibraryManager>();
|
||||||
|
string[] fields = (string[])context.HttpContext.Items["fields"];
|
||||||
|
Type pageType = Utility.GetGenericDefinition(result.DeclaredType, typeof(Page<>));
|
||||||
|
|
||||||
|
|
||||||
|
if (pageType != null)
|
||||||
|
{
|
||||||
|
foreach (IResource resource in ((Page<IResource>)result.Value).Items)
|
||||||
|
{
|
||||||
|
foreach (string field in fields!)
|
||||||
|
await library!.Load(resource, field);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (result.DeclaredType.IsAssignableTo(typeof(IResource)))
|
||||||
|
{
|
||||||
|
foreach (string field in fields!)
|
||||||
|
await library!.Load(result.Value as IResource, field);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -33,10 +33,6 @@ namespace Kyoo.Api
|
|||||||
[FromQuery] Dictionary<string, string> where,
|
[FromQuery] Dictionary<string, string> where,
|
||||||
[FromQuery] int limit = 30)
|
[FromQuery] int limit = 30)
|
||||||
{
|
{
|
||||||
where.Remove("sortBy");
|
|
||||||
where.Remove("limit");
|
|
||||||
where.Remove("afterID");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ICollection<Show> resources = await _libraryManager.GetShows(
|
ICollection<Show> resources = await _libraryManager.GetShows(
|
||||||
@ -63,10 +59,6 @@ namespace Kyoo.Api
|
|||||||
[FromQuery] Dictionary<string, string> where,
|
[FromQuery] Dictionary<string, string> where,
|
||||||
[FromQuery] int limit = 30)
|
[FromQuery] int limit = 30)
|
||||||
{
|
{
|
||||||
where.Remove("sortBy");
|
|
||||||
where.Remove("limit");
|
|
||||||
where.Remove("afterID");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ICollection<Show> resources = await _libraryManager.GetShows(
|
ICollection<Show> resources = await _libraryManager.GetShows(
|
||||||
@ -93,10 +85,6 @@ namespace Kyoo.Api
|
|||||||
[FromQuery] Dictionary<string, string> where,
|
[FromQuery] Dictionary<string, string> where,
|
||||||
[FromQuery] int limit = 30)
|
[FromQuery] int limit = 30)
|
||||||
{
|
{
|
||||||
where.Remove("sortBy");
|
|
||||||
where.Remove("limit");
|
|
||||||
where.Remove("afterID");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ICollection<Library> resources = await _libraryManager.GetLibraries(
|
ICollection<Library> resources = await _libraryManager.GetLibraries(
|
||||||
@ -123,10 +111,6 @@ namespace Kyoo.Api
|
|||||||
[FromQuery] Dictionary<string, string> where,
|
[FromQuery] Dictionary<string, string> where,
|
||||||
[FromQuery] int limit = 30)
|
[FromQuery] int limit = 30)
|
||||||
{
|
{
|
||||||
where.Remove("sortBy");
|
|
||||||
where.Remove("limit");
|
|
||||||
where.Remove("afterID");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ICollection<Library> resources = await _libraryManager.GetLibraries(
|
ICollection<Library> resources = await _libraryManager.GetLibraries(
|
||||||
|
@ -77,9 +77,7 @@ namespace Kyoo.Api
|
|||||||
[FromQuery] Dictionary<string, string> where,
|
[FromQuery] Dictionary<string, string> where,
|
||||||
[FromQuery] int limit = 30)
|
[FromQuery] int limit = 30)
|
||||||
{
|
{
|
||||||
where.Remove("sortBy");
|
|
||||||
where.Remove("limit");
|
|
||||||
where.Remove("afterID");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -109,9 +107,7 @@ namespace Kyoo.Api
|
|||||||
[FromQuery] Dictionary<string, string> where,
|
[FromQuery] Dictionary<string, string> where,
|
||||||
[FromQuery] int limit = 30)
|
[FromQuery] int limit = 30)
|
||||||
{
|
{
|
||||||
where.Remove("sortBy");
|
|
||||||
where.Remove("limit");
|
|
||||||
where.Remove("afterID");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -143,9 +139,7 @@ namespace Kyoo.Api
|
|||||||
[FromQuery] Dictionary<string, string> where,
|
[FromQuery] Dictionary<string, string> where,
|
||||||
[FromQuery] int limit = 30)
|
[FromQuery] int limit = 30)
|
||||||
{
|
{
|
||||||
where.Remove("sortBy");
|
|
||||||
where.Remove("limit");
|
|
||||||
where.Remove("afterID");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -34,10 +34,6 @@ namespace Kyoo.Api
|
|||||||
[FromQuery] Dictionary<string, string> where,
|
[FromQuery] Dictionary<string, string> where,
|
||||||
[FromQuery] int limit = 20)
|
[FromQuery] int limit = 20)
|
||||||
{
|
{
|
||||||
where.Remove("sortBy");
|
|
||||||
where.Remove("limit");
|
|
||||||
where.Remove("afterID");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ICollection<Show> resources = await _libraryManager.GetShows(
|
ICollection<Show> resources = await _libraryManager.GetShows(
|
||||||
@ -64,10 +60,6 @@ namespace Kyoo.Api
|
|||||||
[FromQuery] Dictionary<string, string> where,
|
[FromQuery] Dictionary<string, string> where,
|
||||||
[FromQuery] int limit = 20)
|
[FromQuery] int limit = 20)
|
||||||
{
|
{
|
||||||
where.Remove("sortBy");
|
|
||||||
where.Remove("limit");
|
|
||||||
where.Remove("afterID");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ICollection<Show> resources = await _libraryManager.GetShows(
|
ICollection<Show> resources = await _libraryManager.GetShows(
|
||||||
|
@ -45,10 +45,6 @@ namespace Kyoo.Api
|
|||||||
[FromQuery] Dictionary<string, string> where,
|
[FromQuery] Dictionary<string, string> where,
|
||||||
[FromQuery] int limit = 50)
|
[FromQuery] int limit = 50)
|
||||||
{
|
{
|
||||||
where.Remove("sortBy");
|
|
||||||
where.Remove("limit");
|
|
||||||
where.Remove("afterID");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ICollection<Show> resources = await _libraryManager.GetShows(
|
ICollection<Show> resources = await _libraryManager.GetShows(
|
||||||
@ -75,10 +71,6 @@ namespace Kyoo.Api
|
|||||||
[FromQuery] Dictionary<string, string> where,
|
[FromQuery] Dictionary<string, string> where,
|
||||||
[FromQuery] int limit = 20)
|
[FromQuery] int limit = 20)
|
||||||
{
|
{
|
||||||
where.Remove("sortBy");
|
|
||||||
where.Remove("limit");
|
|
||||||
where.Remove("afterID");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ICollection<Show> resources = await _libraryManager.GetShows(
|
ICollection<Show> resources = await _libraryManager.GetShows(
|
||||||
@ -105,10 +97,6 @@ namespace Kyoo.Api
|
|||||||
[FromQuery] Dictionary<string, string> where,
|
[FromQuery] Dictionary<string, string> where,
|
||||||
[FromQuery] int limit = 50)
|
[FromQuery] int limit = 50)
|
||||||
{
|
{
|
||||||
where.Remove("sortBy");
|
|
||||||
where.Remove("limit");
|
|
||||||
where.Remove("afterID");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ICollection<Collection> resources = await _libraryManager.GetCollections(
|
ICollection<Collection> resources = await _libraryManager.GetCollections(
|
||||||
@ -135,10 +123,6 @@ namespace Kyoo.Api
|
|||||||
[FromQuery] Dictionary<string, string> where,
|
[FromQuery] Dictionary<string, string> where,
|
||||||
[FromQuery] int limit = 20)
|
[FromQuery] int limit = 20)
|
||||||
{
|
{
|
||||||
where.Remove("sortBy");
|
|
||||||
where.Remove("limit");
|
|
||||||
where.Remove("afterID");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ICollection<Collection> resources = await _libraryManager.GetCollections(
|
ICollection<Collection> resources = await _libraryManager.GetCollections(
|
||||||
@ -165,10 +149,6 @@ namespace Kyoo.Api
|
|||||||
[FromQuery] Dictionary<string, string> where,
|
[FromQuery] Dictionary<string, string> where,
|
||||||
[FromQuery] int limit = 50)
|
[FromQuery] int limit = 50)
|
||||||
{
|
{
|
||||||
where.Remove("sortBy");
|
|
||||||
where.Remove("limit");
|
|
||||||
where.Remove("afterID");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ICollection<LibraryItem> resources = await _libraryManager.GetItemsFromLibrary(id,
|
ICollection<LibraryItem> resources = await _libraryManager.GetItemsFromLibrary(id,
|
||||||
@ -195,10 +175,6 @@ namespace Kyoo.Api
|
|||||||
[FromQuery] Dictionary<string, string> where,
|
[FromQuery] Dictionary<string, string> where,
|
||||||
[FromQuery] int limit = 50)
|
[FromQuery] int limit = 50)
|
||||||
{
|
{
|
||||||
where.Remove("sortBy");
|
|
||||||
where.Remove("limit");
|
|
||||||
where.Remove("afterID");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ICollection<LibraryItem> resources = await _libraryManager.GetItemsFromLibrary(slug,
|
ICollection<LibraryItem> resources = await _libraryManager.GetItemsFromLibrary(slug,
|
||||||
|
@ -34,10 +34,6 @@ namespace Kyoo.Api
|
|||||||
[FromQuery] Dictionary<string, string> where,
|
[FromQuery] Dictionary<string, string> where,
|
||||||
[FromQuery] int limit = 50)
|
[FromQuery] int limit = 50)
|
||||||
{
|
{
|
||||||
where.Remove("sortBy");
|
|
||||||
where.Remove("limit");
|
|
||||||
where.Remove("afterID");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ICollection<LibraryItem> resources = await _libraryItems.GetAll(
|
ICollection<LibraryItem> resources = await _libraryItems.GetAll(
|
||||||
|
@ -36,10 +36,6 @@ namespace Kyoo.Api
|
|||||||
[FromQuery] Dictionary<string, string> where,
|
[FromQuery] Dictionary<string, string> where,
|
||||||
[FromQuery] int limit = 20)
|
[FromQuery] int limit = 20)
|
||||||
{
|
{
|
||||||
where.Remove("sortBy");
|
|
||||||
where.Remove("limit");
|
|
||||||
where.Remove("afterID");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ICollection<ShowRole> resources = await _libraryManager.GetRolesFromPeople(id,
|
ICollection<ShowRole> resources = await _libraryManager.GetRolesFromPeople(id,
|
||||||
@ -69,10 +65,6 @@ namespace Kyoo.Api
|
|||||||
[FromQuery] Dictionary<string, string> where,
|
[FromQuery] Dictionary<string, string> where,
|
||||||
[FromQuery] int limit = 20)
|
[FromQuery] int limit = 20)
|
||||||
{
|
{
|
||||||
where.Remove("sortBy");
|
|
||||||
where.Remove("limit");
|
|
||||||
where.Remove("afterID");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ICollection<ShowRole> resources = await _libraryManager.GetRolesFromPeople(slug,
|
ICollection<ShowRole> resources = await _libraryManager.GetRolesFromPeople(slug,
|
||||||
|
@ -33,10 +33,6 @@ namespace Kyoo.Api
|
|||||||
[FromQuery] Dictionary<string, string> where,
|
[FromQuery] Dictionary<string, string> where,
|
||||||
[FromQuery] int limit = 30)
|
[FromQuery] int limit = 30)
|
||||||
{
|
{
|
||||||
where.Remove("sortBy");
|
|
||||||
where.Remove("limit");
|
|
||||||
where.Remove("afterID");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ICollection<Episode> resources = await _libraryManager.GetEpisodes(
|
ICollection<Episode> resources = await _libraryManager.GetEpisodes(
|
||||||
@ -64,10 +60,6 @@ namespace Kyoo.Api
|
|||||||
[FromQuery] Dictionary<string, string> where,
|
[FromQuery] Dictionary<string, string> where,
|
||||||
[FromQuery] int limit = 30)
|
[FromQuery] int limit = 30)
|
||||||
{
|
{
|
||||||
where.Remove("sortBy");
|
|
||||||
where.Remove("limit");
|
|
||||||
where.Remove("afterID");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ICollection<Episode> resources = await _libraryManager.GetEpisodes(
|
ICollection<Episode> resources = await _libraryManager.GetEpisodes(
|
||||||
@ -96,10 +88,6 @@ namespace Kyoo.Api
|
|||||||
[FromQuery] Dictionary<string, string> where,
|
[FromQuery] Dictionary<string, string> where,
|
||||||
[FromQuery] int limit = 30)
|
[FromQuery] int limit = 30)
|
||||||
{
|
{
|
||||||
where.Remove("sortBy");
|
|
||||||
where.Remove("limit");
|
|
||||||
where.Remove("afterID");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ICollection<Episode> resources = await _libraryManager.GetEpisodes(
|
ICollection<Episode> resources = await _libraryManager.GetEpisodes(
|
||||||
|
@ -37,10 +37,6 @@ namespace Kyoo.Api
|
|||||||
[FromQuery] Dictionary<string, string> where,
|
[FromQuery] Dictionary<string, string> where,
|
||||||
[FromQuery] int limit = 20)
|
[FromQuery] int limit = 20)
|
||||||
{
|
{
|
||||||
where.Remove("sortBy");
|
|
||||||
where.Remove("limit");
|
|
||||||
where.Remove("afterID");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ICollection<Season> resources = await _libraryManager.GetSeasons(
|
ICollection<Season> resources = await _libraryManager.GetSeasons(
|
||||||
@ -67,10 +63,6 @@ namespace Kyoo.Api
|
|||||||
[FromQuery] Dictionary<string, string> where,
|
[FromQuery] Dictionary<string, string> where,
|
||||||
[FromQuery] int limit = 20)
|
[FromQuery] int limit = 20)
|
||||||
{
|
{
|
||||||
where.Remove("sortBy");
|
|
||||||
where.Remove("limit");
|
|
||||||
where.Remove("afterID");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ICollection<Season> resources = await _libraryManager.GetSeasons(
|
ICollection<Season> resources = await _libraryManager.GetSeasons(
|
||||||
@ -97,10 +89,6 @@ namespace Kyoo.Api
|
|||||||
[FromQuery] Dictionary<string, string> where,
|
[FromQuery] Dictionary<string, string> where,
|
||||||
[FromQuery] int limit = 50)
|
[FromQuery] int limit = 50)
|
||||||
{
|
{
|
||||||
where.Remove("sortBy");
|
|
||||||
where.Remove("limit");
|
|
||||||
where.Remove("afterID");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ICollection<Episode> resources = await _libraryManager.GetEpisodes(
|
ICollection<Episode> resources = await _libraryManager.GetEpisodes(
|
||||||
@ -127,10 +115,6 @@ namespace Kyoo.Api
|
|||||||
[FromQuery] Dictionary<string, string> where,
|
[FromQuery] Dictionary<string, string> where,
|
||||||
[FromQuery] int limit = 50)
|
[FromQuery] int limit = 50)
|
||||||
{
|
{
|
||||||
where.Remove("sortBy");
|
|
||||||
where.Remove("limit");
|
|
||||||
where.Remove("afterID");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ICollection<Episode> resources = await _libraryManager.GetEpisodes(
|
ICollection<Episode> resources = await _libraryManager.GetEpisodes(
|
||||||
@ -156,10 +140,6 @@ namespace Kyoo.Api
|
|||||||
[FromQuery] Dictionary<string, string> where,
|
[FromQuery] Dictionary<string, string> where,
|
||||||
[FromQuery] int limit = 30)
|
[FromQuery] int limit = 30)
|
||||||
{
|
{
|
||||||
where.Remove("sortBy");
|
|
||||||
where.Remove("limit");
|
|
||||||
where.Remove("afterID");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ICollection<PeopleRole> resources = await _libraryManager.GetPeopleFromShow(showID,
|
ICollection<PeopleRole> resources = await _libraryManager.GetPeopleFromShow(showID,
|
||||||
@ -185,10 +165,6 @@ namespace Kyoo.Api
|
|||||||
[FromQuery] Dictionary<string, string> where,
|
[FromQuery] Dictionary<string, string> where,
|
||||||
[FromQuery] int limit = 30)
|
[FromQuery] int limit = 30)
|
||||||
{
|
{
|
||||||
where.Remove("sortBy");
|
|
||||||
where.Remove("limit");
|
|
||||||
where.Remove("afterID");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ICollection<PeopleRole> resources = await _libraryManager.GetPeopleFromShow(slug,
|
ICollection<PeopleRole> resources = await _libraryManager.GetPeopleFromShow(slug,
|
||||||
@ -215,10 +191,6 @@ namespace Kyoo.Api
|
|||||||
[FromQuery] Dictionary<string, string> where,
|
[FromQuery] Dictionary<string, string> where,
|
||||||
[FromQuery] int limit = 30)
|
[FromQuery] int limit = 30)
|
||||||
{
|
{
|
||||||
where.Remove("sortBy");
|
|
||||||
where.Remove("limit");
|
|
||||||
where.Remove("afterID");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ICollection<Genre> resources = await _libraryManager.GetGenres(
|
ICollection<Genre> resources = await _libraryManager.GetGenres(
|
||||||
@ -245,10 +217,6 @@ namespace Kyoo.Api
|
|||||||
[FromQuery] Dictionary<string, string> where,
|
[FromQuery] Dictionary<string, string> where,
|
||||||
[FromQuery] int limit = 30)
|
[FromQuery] int limit = 30)
|
||||||
{
|
{
|
||||||
where.Remove("sortBy");
|
|
||||||
where.Remove("limit");
|
|
||||||
where.Remove("afterID");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ICollection<Genre> resources = await _libraryManager.GetGenres(
|
ICollection<Genre> resources = await _libraryManager.GetGenres(
|
||||||
@ -303,10 +271,6 @@ namespace Kyoo.Api
|
|||||||
[FromQuery] Dictionary<string, string> where,
|
[FromQuery] Dictionary<string, string> where,
|
||||||
[FromQuery] int limit = 30)
|
[FromQuery] int limit = 30)
|
||||||
{
|
{
|
||||||
where.Remove("sortBy");
|
|
||||||
where.Remove("limit");
|
|
||||||
where.Remove("afterID");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ICollection<Library> resources = await _libraryManager.GetLibraries(
|
ICollection<Library> resources = await _libraryManager.GetLibraries(
|
||||||
@ -333,10 +297,6 @@ namespace Kyoo.Api
|
|||||||
[FromQuery] Dictionary<string, string> where,
|
[FromQuery] Dictionary<string, string> where,
|
||||||
[FromQuery] int limit = 30)
|
[FromQuery] int limit = 30)
|
||||||
{
|
{
|
||||||
where.Remove("sortBy");
|
|
||||||
where.Remove("limit");
|
|
||||||
where.Remove("afterID");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ICollection<Library> resources = await _libraryManager.GetLibraries(
|
ICollection<Library> resources = await _libraryManager.GetLibraries(
|
||||||
@ -363,10 +323,6 @@ namespace Kyoo.Api
|
|||||||
[FromQuery] Dictionary<string, string> where,
|
[FromQuery] Dictionary<string, string> where,
|
||||||
[FromQuery] int limit = 30)
|
[FromQuery] int limit = 30)
|
||||||
{
|
{
|
||||||
where.Remove("sortBy");
|
|
||||||
where.Remove("limit");
|
|
||||||
where.Remove("afterID");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ICollection<Collection> resources = await _libraryManager.GetCollections(
|
ICollection<Collection> resources = await _libraryManager.GetCollections(
|
||||||
@ -393,10 +349,6 @@ namespace Kyoo.Api
|
|||||||
[FromQuery] Dictionary<string, string> where,
|
[FromQuery] Dictionary<string, string> where,
|
||||||
[FromQuery] int limit = 30)
|
[FromQuery] int limit = 30)
|
||||||
{
|
{
|
||||||
where.Remove("sortBy");
|
|
||||||
where.Remove("limit");
|
|
||||||
where.Remove("afterID");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ICollection<Collection> resources = await _libraryManager.GetCollections(
|
ICollection<Collection> resources = await _libraryManager.GetCollections(
|
||||||
|
@ -34,10 +34,6 @@ namespace Kyoo.Api
|
|||||||
[FromQuery] Dictionary<string, string> where,
|
[FromQuery] Dictionary<string, string> where,
|
||||||
[FromQuery] int limit = 20)
|
[FromQuery] int limit = 20)
|
||||||
{
|
{
|
||||||
where.Remove("sortBy");
|
|
||||||
where.Remove("limit");
|
|
||||||
where.Remove("afterID");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ICollection<Show> resources = await _libraryManager.GetShows(
|
ICollection<Show> resources = await _libraryManager.GetShows(
|
||||||
@ -64,10 +60,6 @@ namespace Kyoo.Api
|
|||||||
[FromQuery] Dictionary<string, string> where,
|
[FromQuery] Dictionary<string, string> where,
|
||||||
[FromQuery] int limit = 20)
|
[FromQuery] int limit = 20)
|
||||||
{
|
{
|
||||||
where.Remove("sortBy");
|
|
||||||
where.Remove("limit");
|
|
||||||
where.Remove("afterID");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ICollection<Show> resources = await _libraryManager.GetShows(
|
ICollection<Show> resources = await _libraryManager.GetShows(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user