Adding parameters everywhere

This commit is contained in:
Zoe Roux
2020-06-28 23:30:10 +02:00
parent 3eaf4c005a
commit 38bb0a2efe
13 changed files with 168 additions and 48 deletions
+75 -11
View File
@@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using JetBrains.Annotations;
using Kyoo.Models;
@@ -36,18 +38,80 @@ namespace Kyoo.Controllers
Task AddShowLink([NotNull] Show show, Library library, Collection collection);
// Get all
Task<ICollection<Library>> GetLibraries();
Task<ICollection<Collection>> GetCollections();
Task<ICollection<Show>> GetShows();
Task<ICollection<Season>> GetSeasons();
Task<ICollection<Episode>> GetEpisodes();
Task<ICollection<Track>> GetTracks();
Task<ICollection<Studio>> GetStudios();
Task<ICollection<People>> GetPeoples();
Task<ICollection<Genre>> GetGenres();
Task<ICollection<ProviderID>> GetProviders();
Task<ICollection<Library>> GetLibraries(Expression<Func<Library, bool>> where = null,
Sort<Library> sort = default,
Pagination page = default);
Task<ICollection<Collection>> GetCollections(Expression<Func<Collection, bool>> where = null,
Sort<Collection> sort = default,
Pagination page = default);
Task<ICollection<Show>> GetShows(Expression<Func<Show, bool>> where = null,
Sort<Show> sort = default,
Pagination page = default);
Task<ICollection<Season>> GetSeasons(Expression<Func<Season, bool>> where = null,
Sort<Season> sort = default,
Pagination page = default);
Task<ICollection<Episode>> GetEpisodes(Expression<Func<Episode, bool>> where = null,
Sort<Episode> sort = default,
Pagination page = default);
Task<ICollection<Track>> GetTracks(Expression<Func<Track, bool>> where = null,
Sort<Track> sort = default,
Pagination page = default);
Task<ICollection<Studio>> GetStudios(Expression<Func<Studio, bool>> where = null,
Sort<Studio> sort = default,
Pagination page = default);
Task<ICollection<People>> GetPeople(Expression<Func<People, bool>> where = null,
Sort<People> sort = default,
Pagination page = default);
Task<ICollection<Genre>> GetGenres(Expression<Func<Genre, bool>> where = null,
Sort<Genre> sort = default,
Pagination page = default);
Task<ICollection<ProviderID>> GetProviders(Expression<Func<ProviderID, bool>> where = null,
Sort<ProviderID> sort = default,
Pagination page = default);
Task<ICollection<Library>> GetLibraries([Optional] Expression<Func<Library, bool>> where,
Expression<Func<Library, object>> sort,
Pagination page = default
) => GetLibraries(where, new Sort<Library>(sort), page);
Task<ICollection<Collection>> GetCollections([Optional] Expression<Func<Collection, bool>> where,
Expression<Func<Collection, object>> sort,
Pagination page = default
) => GetCollections(where, new Sort<Collection>(sort), page);
Task<ICollection<Show>> GetShows([Optional] Expression<Func<Show, bool>> where,
Expression<Func<Show, object>> sort,
Pagination page = default
) => GetShows(where, new Sort<Show>(sort), page);
Task<ICollection<Season>> GetSeasons([Optional] Expression<Func<Season, bool>> where,
Expression<Func<Season, object>> sort,
Pagination page = default
) => GetSeasons(where, new Sort<Season>(sort), page);
Task<ICollection<Episode>> GetEpisodes([Optional] Expression<Func<Episode, bool>> where,
Expression<Func<Episode, object>> sort,
Pagination page = default
) => GetEpisodes(where, new Sort<Episode>(sort), page);
Task<ICollection<Track>> GetTracks([Optional] Expression<Func<Track, bool>> where,
Expression<Func<Track, object>> sort,
Pagination page = default
) => GetTracks(where, new Sort<Track>(sort), page);
Task<ICollection<Studio>> GetStudios([Optional] Expression<Func<Studio, bool>> where,
Expression<Func<Studio, object>> sort,
Pagination page = default
) => GetStudios(where, new Sort<Studio>(sort), page);
Task<ICollection<People>> GetPeople([Optional] Expression<Func<People, bool>> where,
Expression<Func<People, object>> sort,
Pagination page = default
) => GetPeople(where, new Sort<People>(sort), page);
Task<ICollection<Genre>> GetGenres([Optional] Expression<Func<Genre, bool>> where,
Expression<Func<Genre, object>> sort,
Pagination page = default
) => GetGenres(where, new Sort<Genre>(sort), page);
Task<ICollection<ProviderID>> GetProviders([Optional] Expression<Func<ProviderID, bool>> where,
Expression<Func<ProviderID, object>> sort,
Pagination page = default
) => GetProviders(where, new Sort<ProviderID>(sort), page);
// Search
// Search
Task<ICollection<Library>> SearchLibraries(string searchQuery);
Task<ICollection<Collection>> SearchCollections(string searchQuery);
Task<ICollection<Show>> SearchShows(string searchQuery);
+3 -2
View File
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using JetBrains.Annotations;
using Kyoo.Models;
@@ -42,8 +43,8 @@ namespace Kyoo.Controllers
Sort<T> sort = default,
Pagination page = default);
Task<ICollection<T>> GetAll(Expression<Func<T, bool>> where = null,
Expression<Func<T, object>> sort = default,
Task<ICollection<T>> GetAll([Optional] Expression<Func<T, bool>> where,
Expression<Func<T, object>> sort,
Pagination page = default
) => GetAll(where, new Sort<T>(sort), page);