mirror of
				https://github.com/zoriya/Kyoo.git
				synced 2025-11-03 19:17:16 -05:00 
			
		
		
		
	Completing the basic show api
This commit is contained in:
		
							parent
							
								
									81f555ca7e
								
							
						
					
					
						commit
						3e7ddff99e
					
				@ -10,6 +10,18 @@ namespace Kyoo.Controllers
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	public interface ILibraryManager : IDisposable, IAsyncDisposable
 | 
						public interface ILibraryManager : IDisposable, IAsyncDisposable
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
 | 
							// Repositories
 | 
				
			||||||
 | 
							ILibraryRepository LibraryRepository { get; }
 | 
				
			||||||
 | 
							ICollectionRepository CollectionRepository { get; }
 | 
				
			||||||
 | 
							IShowRepository ShowRepository { get; }
 | 
				
			||||||
 | 
							ISeasonRepository SeasonRepository { get; }
 | 
				
			||||||
 | 
							IEpisodeRepository EpisodeRepository { get; }
 | 
				
			||||||
 | 
							ITrackRepository TrackRepository { get; }
 | 
				
			||||||
 | 
							IPeopleRepository PeopleRepository { get; }
 | 
				
			||||||
 | 
							IStudioRepository StudioRepository { get; }
 | 
				
			||||||
 | 
							IGenreRepository GenreRepository { get; }
 | 
				
			||||||
 | 
							IProviderRepository ProviderRepository { get; }
 | 
				
			||||||
 | 
							
 | 
				
			||||||
		// Get by slug
 | 
							// Get by slug
 | 
				
			||||||
		Task<Library> GetLibrary(string slug);
 | 
							Task<Library> GetLibrary(string slug);
 | 
				
			||||||
		Task<Collection> GetCollection(string slug);
 | 
							Task<Collection> GetCollection(string slug);
 | 
				
			||||||
@ -24,8 +36,24 @@ namespace Kyoo.Controllers
 | 
				
			|||||||
		Task<People> GetPeople(string slug);
 | 
							Task<People> GetPeople(string slug);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Get by relations
 | 
							// Get by relations
 | 
				
			||||||
		Task<ICollection<Season>> GetSeasons(int showID);
 | 
							Task<ICollection<Season>> GetSeasons(int showID,
 | 
				
			||||||
		Task<ICollection<Season>> GetSeasons(string showSlug);
 | 
								Expression<Func<Season, bool>> where = null, 
 | 
				
			||||||
 | 
								Sort<Season> sort = default,
 | 
				
			||||||
 | 
								Pagination limit = default);
 | 
				
			||||||
 | 
							Task<ICollection<Season>> GetSeasons(int showID,
 | 
				
			||||||
 | 
								[Optional] Expression<Func<Season, bool>> where,
 | 
				
			||||||
 | 
								Expression<Func<Season, object>> sort,
 | 
				
			||||||
 | 
								Pagination limit = default
 | 
				
			||||||
 | 
							) => GetSeasons(showID, where, new Sort<Season>(sort), limit);
 | 
				
			||||||
 | 
							Task<ICollection<Season>> GetSeasons(string showSlug,
 | 
				
			||||||
 | 
								Expression<Func<Season, bool>> where = null, 
 | 
				
			||||||
 | 
								Sort<Season> sort = default,
 | 
				
			||||||
 | 
								Pagination limit = default);
 | 
				
			||||||
 | 
							Task<ICollection<Season>> GetSeasons(string showSlug,
 | 
				
			||||||
 | 
								[Optional] Expression<Func<Season, bool>> where,
 | 
				
			||||||
 | 
								Expression<Func<Season, object>> sort,
 | 
				
			||||||
 | 
								Pagination limit = default
 | 
				
			||||||
 | 
							) => GetSeasons(showSlug, where, new Sort<Season>(sort), limit);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		Task<ICollection<Episode>> GetEpisodes(int showID, int seasonNumber);
 | 
							Task<ICollection<Episode>> GetEpisodes(int showID, int seasonNumber);
 | 
				
			||||||
		Task<ICollection<Episode>> GetEpisodes(string showSlug, int seasonNumber);
 | 
							Task<ICollection<Episode>> GetEpisodes(string showSlug, int seasonNumber);
 | 
				
			||||||
 | 
				
			|||||||
@ -109,8 +109,26 @@ namespace Kyoo.Controllers
 | 
				
			|||||||
		Task<Season> Get(string showSlug, int seasonNumber);
 | 
							Task<Season> Get(string showSlug, int seasonNumber);
 | 
				
			||||||
		Task Delete(string showSlug, int seasonNumber);
 | 
							Task Delete(string showSlug, int seasonNumber);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		Task<ICollection<Season>> GetSeasons(int showID);
 | 
							Task<ICollection<Season>> GetSeasons(int showID,
 | 
				
			||||||
		Task<ICollection<Season>> GetSeasons(string showSlug);
 | 
								Expression<Func<Season, bool>> where = null, 
 | 
				
			||||||
 | 
								Sort<Season> sort = default,
 | 
				
			||||||
 | 
								Pagination limit = default);
 | 
				
			||||||
 | 
							Task<ICollection<Season>> GetSeasons(int showID,
 | 
				
			||||||
 | 
								[Optional] Expression<Func<Season, bool>> where,
 | 
				
			||||||
 | 
								Expression<Func<Season, object>> sort,
 | 
				
			||||||
 | 
								Pagination limit = default
 | 
				
			||||||
 | 
							) => GetSeasons(showID, where, new Sort<Season>(sort), limit);
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							Task<ICollection<Season>> GetSeasons(string showSlug,
 | 
				
			||||||
 | 
								Expression<Func<Season, bool>> where = null, 
 | 
				
			||||||
 | 
								Sort<Season> sort = default,
 | 
				
			||||||
 | 
								Pagination limit = default);
 | 
				
			||||||
 | 
							Task<ICollection<Season>> GetSeasons(string showSlug,
 | 
				
			||||||
 | 
								[Optional] Expression<Func<Season, bool>> where,
 | 
				
			||||||
 | 
								Expression<Func<Season, object>> sort,
 | 
				
			||||||
 | 
								Pagination limit = default
 | 
				
			||||||
 | 
							) => GetSeasons(showSlug, where, new Sort<Season>(sort), limit);
 | 
				
			||||||
 | 
							
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	public interface IEpisodeRepository : IRepository<Episode>
 | 
						public interface IEpisodeRepository : IRepository<Episode>
 | 
				
			||||||
 | 
				
			|||||||
@ -8,223 +8,229 @@ namespace Kyoo.Controllers
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	public class LibraryManager : ILibraryManager
 | 
						public class LibraryManager : ILibraryManager
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		private readonly ILibraryRepository _libraries;
 | 
							public ILibraryRepository LibraryRepository { get; }
 | 
				
			||||||
		private readonly ICollectionRepository _collections;
 | 
							public ICollectionRepository CollectionRepository { get; }
 | 
				
			||||||
		private readonly IShowRepository _shows;
 | 
							public IShowRepository ShowRepository { get; }
 | 
				
			||||||
		private readonly ISeasonRepository _seasons;
 | 
							public ISeasonRepository SeasonRepository { get; }
 | 
				
			||||||
		private readonly IEpisodeRepository _episodes;
 | 
							public IEpisodeRepository EpisodeRepository { get; }
 | 
				
			||||||
		private readonly ITrackRepository _tracks;
 | 
							public ITrackRepository TrackRepository { get; }
 | 
				
			||||||
		private readonly IGenreRepository _genres;
 | 
							public IGenreRepository GenreRepository { get; }
 | 
				
			||||||
		private readonly IStudioRepository _studios;
 | 
							public IStudioRepository StudioRepository { get; }
 | 
				
			||||||
		private readonly IPeopleRepository _people;
 | 
							public IPeopleRepository PeopleRepository { get; }
 | 
				
			||||||
		private readonly IProviderRepository _providers;
 | 
							public IProviderRepository ProviderRepository { get; }
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		public LibraryManager(ILibraryRepository libraries, 
 | 
							public LibraryManager(ILibraryRepository libraryRepository, 
 | 
				
			||||||
			ICollectionRepository collections, 
 | 
								ICollectionRepository collectionRepository, 
 | 
				
			||||||
			IShowRepository shows, 
 | 
								IShowRepository showRepository, 
 | 
				
			||||||
			ISeasonRepository seasons, 
 | 
								ISeasonRepository seasonRepository, 
 | 
				
			||||||
			IEpisodeRepository episodes,
 | 
								IEpisodeRepository episodeRepository,
 | 
				
			||||||
			ITrackRepository tracks, 
 | 
								ITrackRepository trackRepository, 
 | 
				
			||||||
			IGenreRepository genres, 
 | 
								IGenreRepository genreRepository, 
 | 
				
			||||||
			IStudioRepository studios,
 | 
								IStudioRepository studioRepository,
 | 
				
			||||||
			IProviderRepository providers, 
 | 
								IProviderRepository providerRepository, 
 | 
				
			||||||
			IPeopleRepository people)
 | 
								IPeopleRepository peopleRepository)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			_libraries = libraries;
 | 
								LibraryRepository = libraryRepository;
 | 
				
			||||||
			_collections = collections;
 | 
								CollectionRepository = collectionRepository;
 | 
				
			||||||
			_shows = shows;
 | 
								ShowRepository = showRepository;
 | 
				
			||||||
			_seasons = seasons;
 | 
								SeasonRepository = seasonRepository;
 | 
				
			||||||
			_episodes = episodes;
 | 
								EpisodeRepository = episodeRepository;
 | 
				
			||||||
			_tracks = tracks;
 | 
								TrackRepository = trackRepository;
 | 
				
			||||||
			_genres = genres;
 | 
								GenreRepository = genreRepository;
 | 
				
			||||||
			_studios = studios;
 | 
								StudioRepository = studioRepository;
 | 
				
			||||||
			_providers = providers;
 | 
								ProviderRepository = providerRepository;
 | 
				
			||||||
			_people = people;
 | 
								PeopleRepository = peopleRepository;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		public void Dispose()
 | 
							public void Dispose()
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			_libraries.Dispose();
 | 
								LibraryRepository.Dispose();
 | 
				
			||||||
			_collections.Dispose();
 | 
								CollectionRepository.Dispose();
 | 
				
			||||||
			_shows.Dispose();
 | 
								ShowRepository.Dispose();
 | 
				
			||||||
			_seasons.Dispose();
 | 
								SeasonRepository.Dispose();
 | 
				
			||||||
			_episodes.Dispose();
 | 
								EpisodeRepository.Dispose();
 | 
				
			||||||
			_tracks.Dispose();
 | 
								TrackRepository.Dispose();
 | 
				
			||||||
			_genres.Dispose();
 | 
								GenreRepository.Dispose();
 | 
				
			||||||
			_studios.Dispose();
 | 
								StudioRepository.Dispose();
 | 
				
			||||||
			_people.Dispose();
 | 
								PeopleRepository.Dispose();
 | 
				
			||||||
			_providers.Dispose();
 | 
								ProviderRepository.Dispose();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		public async ValueTask DisposeAsync()
 | 
							public async ValueTask DisposeAsync()
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			await Task.WhenAll(
 | 
								await Task.WhenAll(
 | 
				
			||||||
				_libraries.DisposeAsync().AsTask(),
 | 
									LibraryRepository.DisposeAsync().AsTask(),
 | 
				
			||||||
				_collections.DisposeAsync().AsTask(),
 | 
									CollectionRepository.DisposeAsync().AsTask(),
 | 
				
			||||||
				_shows.DisposeAsync().AsTask(),
 | 
									ShowRepository.DisposeAsync().AsTask(),
 | 
				
			||||||
				_seasons.DisposeAsync().AsTask(),
 | 
									SeasonRepository.DisposeAsync().AsTask(),
 | 
				
			||||||
				_episodes.DisposeAsync().AsTask(),
 | 
									EpisodeRepository.DisposeAsync().AsTask(),
 | 
				
			||||||
				_tracks.DisposeAsync().AsTask(),
 | 
									TrackRepository.DisposeAsync().AsTask(),
 | 
				
			||||||
				_genres.DisposeAsync().AsTask(),
 | 
									GenreRepository.DisposeAsync().AsTask(),
 | 
				
			||||||
				_studios.DisposeAsync().AsTask(),
 | 
									StudioRepository.DisposeAsync().AsTask(),
 | 
				
			||||||
				_people.DisposeAsync().AsTask(),
 | 
									PeopleRepository.DisposeAsync().AsTask(),
 | 
				
			||||||
				_providers.DisposeAsync().AsTask()
 | 
									ProviderRepository.DisposeAsync().AsTask()
 | 
				
			||||||
			);
 | 
								);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<Library> GetLibrary(string slug)
 | 
							public Task<Library> GetLibrary(string slug)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _libraries.Get(slug);
 | 
								return LibraryRepository.Get(slug);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<Collection> GetCollection(string slug)
 | 
							public Task<Collection> GetCollection(string slug)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _collections.Get(slug);
 | 
								return CollectionRepository.Get(slug);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<Show> GetShow(string slug)
 | 
							public Task<Show> GetShow(string slug)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _shows.Get(slug);
 | 
								return ShowRepository.Get(slug);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<Season> GetSeason(string showSlug, int seasonNumber)
 | 
							public Task<Season> GetSeason(string showSlug, int seasonNumber)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _seasons.Get(showSlug, seasonNumber);
 | 
								return SeasonRepository.Get(showSlug, seasonNumber);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<Episode> GetEpisode(string showSlug, int seasonNumber, int episodeNumber)
 | 
							public Task<Episode> GetEpisode(string showSlug, int seasonNumber, int episodeNumber)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _episodes.Get(showSlug, seasonNumber, episodeNumber);
 | 
								return EpisodeRepository.Get(showSlug, seasonNumber, episodeNumber);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<Episode> GetMovieEpisode(string movieSlug)
 | 
							public Task<Episode> GetMovieEpisode(string movieSlug)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _episodes.Get(movieSlug);
 | 
								return EpisodeRepository.Get(movieSlug);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<Track> GetTrack(int id)
 | 
							public Task<Track> GetTrack(int id)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _tracks.Get(id);
 | 
								return TrackRepository.Get(id);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		public Task<Track> GetTrack(int episodeID, string language, bool isForced)
 | 
							public Task<Track> GetTrack(int episodeID, string language, bool isForced)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _tracks.Get(episodeID, language, isForced);
 | 
								return TrackRepository.Get(episodeID, language, isForced);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<Genre> GetGenre(string slug)
 | 
							public Task<Genre> GetGenre(string slug)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _genres.Get(slug);
 | 
								return GenreRepository.Get(slug);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<Studio> GetStudio(string slug)
 | 
							public Task<Studio> GetStudio(string slug)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _studios.Get(slug);
 | 
								return StudioRepository.Get(slug);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<People> GetPeople(string slug)
 | 
							public Task<People> GetPeople(string slug)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _people.Get(slug);
 | 
								return PeopleRepository.Get(slug);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<ICollection<Library>> GetLibraries(Expression<Func<Library, bool>> where = null, 
 | 
							public Task<ICollection<Library>> GetLibraries(Expression<Func<Library, bool>> where = null, 
 | 
				
			||||||
			Sort<Library> sort = default,
 | 
								Sort<Library> sort = default,
 | 
				
			||||||
			Pagination page = default)
 | 
								Pagination page = default)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _libraries.GetAll(where, sort, page);
 | 
								return LibraryRepository.GetAll(where, sort, page);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<ICollection<Collection>> GetCollections(Expression<Func<Collection, bool>> where = null, 
 | 
							public Task<ICollection<Collection>> GetCollections(Expression<Func<Collection, bool>> where = null, 
 | 
				
			||||||
			Sort<Collection> sort = default,
 | 
								Sort<Collection> sort = default,
 | 
				
			||||||
			Pagination page = default)
 | 
								Pagination page = default)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _collections.GetAll(where, sort, page);
 | 
								return CollectionRepository.GetAll(where, sort, page);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<ICollection<Show>> GetShows(Expression<Func<Show, bool>> where = null, 
 | 
							public Task<ICollection<Show>> GetShows(Expression<Func<Show, bool>> where = null, 
 | 
				
			||||||
			Sort<Show> sort = default,
 | 
								Sort<Show> sort = default,
 | 
				
			||||||
			Pagination limit = default)
 | 
								Pagination limit = default)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _shows.GetAll(where, sort, limit);
 | 
								return ShowRepository.GetAll(where, sort, limit);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<ICollection<Season>> GetSeasons(Expression<Func<Season, bool>> where = null, 
 | 
							public Task<ICollection<Season>> GetSeasons(Expression<Func<Season, bool>> where = null, 
 | 
				
			||||||
			Sort<Season> sort = default,
 | 
								Sort<Season> sort = default,
 | 
				
			||||||
			Pagination page = default)
 | 
								Pagination page = default)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _seasons.GetAll(where, sort, page);
 | 
								return SeasonRepository.GetAll(where, sort, page);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<ICollection<Episode>> GetEpisodes(Expression<Func<Episode, bool>> where = null, 
 | 
							public Task<ICollection<Episode>> GetEpisodes(Expression<Func<Episode, bool>> where = null, 
 | 
				
			||||||
			Sort<Episode> sort = default,
 | 
								Sort<Episode> sort = default,
 | 
				
			||||||
			Pagination page = default)
 | 
								Pagination page = default)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _episodes.GetAll(where, sort, page);
 | 
								return EpisodeRepository.GetAll(where, sort, page);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<ICollection<Track>> GetTracks(Expression<Func<Track, bool>> where = null, 
 | 
							public Task<ICollection<Track>> GetTracks(Expression<Func<Track, bool>> where = null, 
 | 
				
			||||||
			Sort<Track> sort = default,
 | 
								Sort<Track> sort = default,
 | 
				
			||||||
			Pagination page = default)
 | 
								Pagination page = default)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _tracks.GetAll(where, sort, page);
 | 
								return TrackRepository.GetAll(where, sort, page);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<ICollection<Studio>> GetStudios(Expression<Func<Studio, bool>> where = null, 
 | 
							public Task<ICollection<Studio>> GetStudios(Expression<Func<Studio, bool>> where = null, 
 | 
				
			||||||
			Sort<Studio> sort = default,
 | 
								Sort<Studio> sort = default,
 | 
				
			||||||
			Pagination page = default)
 | 
								Pagination page = default)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _studios.GetAll(where, sort, page);
 | 
								return StudioRepository.GetAll(where, sort, page);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<ICollection<People>> GetPeople(Expression<Func<People, bool>> where = null, 
 | 
							public Task<ICollection<People>> GetPeople(Expression<Func<People, bool>> where = null, 
 | 
				
			||||||
			Sort<People> sort = default,
 | 
								Sort<People> sort = default,
 | 
				
			||||||
			Pagination page = default)
 | 
								Pagination page = default)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _people.GetAll(where, sort, page);
 | 
								return PeopleRepository.GetAll(where, sort, page);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<ICollection<Genre>> GetGenres(Expression<Func<Genre, bool>> where = null, 
 | 
							public Task<ICollection<Genre>> GetGenres(Expression<Func<Genre, bool>> where = null, 
 | 
				
			||||||
			Sort<Genre> sort = default,
 | 
								Sort<Genre> sort = default,
 | 
				
			||||||
			Pagination page = default)
 | 
								Pagination page = default)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _genres.GetAll(where, sort, page);
 | 
								return GenreRepository.GetAll(where, sort, page);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<ICollection<ProviderID>> GetProviders(Expression<Func<ProviderID, bool>> where = null, 
 | 
							public Task<ICollection<ProviderID>> GetProviders(Expression<Func<ProviderID, bool>> where = null, 
 | 
				
			||||||
			Sort<ProviderID> sort = default,
 | 
								Sort<ProviderID> sort = default,
 | 
				
			||||||
			Pagination page = default)
 | 
								Pagination page = default)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _providers.GetAll(where, sort, page); 
 | 
								return ProviderRepository.GetAll(where, sort, page); 
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<ICollection<Season>> GetSeasons(int showID)
 | 
							public Task<ICollection<Season>> GetSeasons(int showID,
 | 
				
			||||||
 | 
								Expression<Func<Season, bool>> where = null, 
 | 
				
			||||||
 | 
								Sort<Season> sort = default,
 | 
				
			||||||
 | 
								Pagination limit = default)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _seasons.GetSeasons(showID);
 | 
								return SeasonRepository.GetSeasons(showID, where, sort, limit);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<ICollection<Season>> GetSeasons(string showSlug)
 | 
							public Task<ICollection<Season>> GetSeasons(string showSlug,
 | 
				
			||||||
 | 
								Expression<Func<Season, bool>> where = null, 
 | 
				
			||||||
 | 
								Sort<Season> sort = default,
 | 
				
			||||||
 | 
								Pagination limit = default)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _seasons.GetSeasons(showSlug);
 | 
								return SeasonRepository.GetSeasons(showSlug, where, sort, limit);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<ICollection<Episode>> GetEpisodes(int showID, int seasonNumber)
 | 
							public Task<ICollection<Episode>> GetEpisodes(int showID, int seasonNumber)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _episodes.GetEpisodes(showID, seasonNumber);
 | 
								return EpisodeRepository.GetEpisodes(showID, seasonNumber);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<ICollection<Episode>> GetEpisodes(string showSlug, int seasonNumber)
 | 
							public Task<ICollection<Episode>> GetEpisodes(string showSlug, int seasonNumber)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _episodes.GetEpisodes(showSlug, seasonNumber);
 | 
								return EpisodeRepository.GetEpisodes(showSlug, seasonNumber);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<ICollection<Episode>> GetEpisodes(int seasonID)
 | 
							public Task<ICollection<Episode>> GetEpisodes(int seasonID)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _episodes.GetEpisodes(seasonID);
 | 
								return EpisodeRepository.GetEpisodes(seasonID);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		public Task AddShowLink(int showID, int? libraryID, int? collectionID)
 | 
							public Task AddShowLink(int showID, int? libraryID, int? collectionID)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _shows.AddShowLink(showID, libraryID, collectionID);
 | 
								return ShowRepository.AddShowLink(showID, libraryID, collectionID);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task AddShowLink(Show show, Library library, Collection collection)
 | 
							public Task AddShowLink(Show show, Library library, Collection collection)
 | 
				
			||||||
@ -236,267 +242,267 @@ namespace Kyoo.Controllers
 | 
				
			|||||||
		
 | 
							
 | 
				
			||||||
		public Task<ICollection<Library>> SearchLibraries(string searchQuery)
 | 
							public Task<ICollection<Library>> SearchLibraries(string searchQuery)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _libraries.Search(searchQuery);
 | 
								return LibraryRepository.Search(searchQuery);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<ICollection<Collection>> SearchCollections(string searchQuery)
 | 
							public Task<ICollection<Collection>> SearchCollections(string searchQuery)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _collections.Search(searchQuery);
 | 
								return CollectionRepository.Search(searchQuery);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<ICollection<Show>> SearchShows(string searchQuery)
 | 
							public Task<ICollection<Show>> SearchShows(string searchQuery)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _shows.Search(searchQuery);
 | 
								return ShowRepository.Search(searchQuery);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<ICollection<Season>> SearchSeasons(string searchQuery)
 | 
							public Task<ICollection<Season>> SearchSeasons(string searchQuery)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _seasons.Search(searchQuery);
 | 
								return SeasonRepository.Search(searchQuery);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<ICollection<Episode>> SearchEpisodes(string searchQuery)
 | 
							public Task<ICollection<Episode>> SearchEpisodes(string searchQuery)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _episodes.Search(searchQuery);
 | 
								return EpisodeRepository.Search(searchQuery);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<ICollection<Genre>> SearchGenres(string searchQuery)
 | 
							public Task<ICollection<Genre>> SearchGenres(string searchQuery)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _genres.Search(searchQuery);
 | 
								return GenreRepository.Search(searchQuery);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<ICollection<Studio>> SearchStudios(string searchQuery)
 | 
							public Task<ICollection<Studio>> SearchStudios(string searchQuery)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _studios.Search(searchQuery);
 | 
								return StudioRepository.Search(searchQuery);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<ICollection<People>> SearchPeople(string searchQuery)
 | 
							public Task<ICollection<People>> SearchPeople(string searchQuery)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _people.Search(searchQuery);
 | 
								return PeopleRepository.Search(searchQuery);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		public Task<Library> RegisterLibrary(Library library)
 | 
							public Task<Library> RegisterLibrary(Library library)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _libraries.Create(library);
 | 
								return LibraryRepository.Create(library);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<Collection> RegisterCollection(Collection collection)
 | 
							public Task<Collection> RegisterCollection(Collection collection)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _collections.Create(collection);
 | 
								return CollectionRepository.Create(collection);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<Show> RegisterShow(Show show)
 | 
							public Task<Show> RegisterShow(Show show)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _shows.Create(show);
 | 
								return ShowRepository.Create(show);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<Season> RegisterSeason(Season season)
 | 
							public Task<Season> RegisterSeason(Season season)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _seasons.Create(season);
 | 
								return SeasonRepository.Create(season);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<Episode> RegisterEpisode(Episode episode)
 | 
							public Task<Episode> RegisterEpisode(Episode episode)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _episodes.Create(episode);
 | 
								return EpisodeRepository.Create(episode);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<Track> RegisterTrack(Track track)
 | 
							public Task<Track> RegisterTrack(Track track)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _tracks.Create(track);
 | 
								return TrackRepository.Create(track);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<Genre> RegisterGenre(Genre genre)
 | 
							public Task<Genre> RegisterGenre(Genre genre)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _genres.Create(genre);
 | 
								return GenreRepository.Create(genre);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<Studio> RegisterStudio(Studio studio)
 | 
							public Task<Studio> RegisterStudio(Studio studio)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _studios.Create(studio);
 | 
								return StudioRepository.Create(studio);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<People> RegisterPeople(People people)
 | 
							public Task<People> RegisterPeople(People people)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _people.Create(people);
 | 
								return PeopleRepository.Create(people);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<Library> EditLibrary(Library library, bool resetOld)
 | 
							public Task<Library> EditLibrary(Library library, bool resetOld)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _libraries.Edit(library, resetOld);
 | 
								return LibraryRepository.Edit(library, resetOld);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<Collection> EditCollection(Collection collection, bool resetOld)
 | 
							public Task<Collection> EditCollection(Collection collection, bool resetOld)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _collections.Edit(collection, resetOld);
 | 
								return CollectionRepository.Edit(collection, resetOld);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<Show> EditShow(Show show, bool resetOld)
 | 
							public Task<Show> EditShow(Show show, bool resetOld)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _shows.Edit(show, resetOld);
 | 
								return ShowRepository.Edit(show, resetOld);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<Season> EditSeason(Season season, bool resetOld)
 | 
							public Task<Season> EditSeason(Season season, bool resetOld)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _seasons.Edit(season, resetOld);
 | 
								return SeasonRepository.Edit(season, resetOld);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<Episode> EditEpisode(Episode episode, bool resetOld)
 | 
							public Task<Episode> EditEpisode(Episode episode, bool resetOld)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _episodes.Edit(episode, resetOld);
 | 
								return EpisodeRepository.Edit(episode, resetOld);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<Track> EditTrack(Track track, bool resetOld)
 | 
							public Task<Track> EditTrack(Track track, bool resetOld)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _tracks.Edit(track, resetOld);
 | 
								return TrackRepository.Edit(track, resetOld);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<Genre> EditGenre(Genre genre, bool resetOld)
 | 
							public Task<Genre> EditGenre(Genre genre, bool resetOld)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _genres.Edit(genre, resetOld);
 | 
								return GenreRepository.Edit(genre, resetOld);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<Studio> EditStudio(Studio studio, bool resetOld)
 | 
							public Task<Studio> EditStudio(Studio studio, bool resetOld)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _studios.Edit(studio, resetOld);
 | 
								return StudioRepository.Edit(studio, resetOld);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<People> EditPeople(People people, bool resetOld)
 | 
							public Task<People> EditPeople(People people, bool resetOld)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _people.Edit(people, resetOld);
 | 
								return PeopleRepository.Edit(people, resetOld);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task DelteLibrary(Library library)
 | 
							public Task DelteLibrary(Library library)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _libraries.Delete(library);
 | 
								return LibraryRepository.Delete(library);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task DeleteCollection(Collection collection)
 | 
							public Task DeleteCollection(Collection collection)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _collections.Delete(collection);
 | 
								return CollectionRepository.Delete(collection);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task DeleteShow(Show show)
 | 
							public Task DeleteShow(Show show)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _shows.Delete(show);
 | 
								return ShowRepository.Delete(show);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task DeleteSeason(Season season)
 | 
							public Task DeleteSeason(Season season)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _seasons.Delete(season);
 | 
								return SeasonRepository.Delete(season);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task DeleteEpisode(Episode episode)
 | 
							public Task DeleteEpisode(Episode episode)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _episodes.Delete(episode);
 | 
								return EpisodeRepository.Delete(episode);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task DeleteTrack(Track track)
 | 
							public Task DeleteTrack(Track track)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _tracks.Delete(track);
 | 
								return TrackRepository.Delete(track);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task DeleteGenre(Genre genre)
 | 
							public Task DeleteGenre(Genre genre)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _genres.Delete(genre);
 | 
								return GenreRepository.Delete(genre);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task DeleteStudio(Studio studio)
 | 
							public Task DeleteStudio(Studio studio)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _studios.Delete(studio);
 | 
								return StudioRepository.Delete(studio);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task DeletePeople(People people)
 | 
							public Task DeletePeople(People people)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _people.Delete(people);
 | 
								return PeopleRepository.Delete(people);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		public Task DelteLibrary(string library)
 | 
							public Task DelteLibrary(string library)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _libraries.Delete(library);
 | 
								return LibraryRepository.Delete(library);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task DeleteCollection(string collection)
 | 
							public Task DeleteCollection(string collection)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _collections.Delete(collection);
 | 
								return CollectionRepository.Delete(collection);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task DeleteShow(string show)
 | 
							public Task DeleteShow(string show)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _shows.Delete(show);
 | 
								return ShowRepository.Delete(show);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task DeleteSeason(string season)
 | 
							public Task DeleteSeason(string season)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _seasons.Delete(season);
 | 
								return SeasonRepository.Delete(season);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task DeleteEpisode(string episode)
 | 
							public Task DeleteEpisode(string episode)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _episodes.Delete(episode);
 | 
								return EpisodeRepository.Delete(episode);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task DeleteTrack(string track)
 | 
							public Task DeleteTrack(string track)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _tracks.Delete(track);
 | 
								return TrackRepository.Delete(track);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task DeleteGenre(string genre)
 | 
							public Task DeleteGenre(string genre)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _genres.Delete(genre);
 | 
								return GenreRepository.Delete(genre);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task DeleteStudio(string studio)
 | 
							public Task DeleteStudio(string studio)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _studios.Delete(studio);
 | 
								return StudioRepository.Delete(studio);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task DeletePeople(string people)
 | 
							public Task DeletePeople(string people)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _people.Delete(people);
 | 
								return PeopleRepository.Delete(people);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		public Task DelteLibrary(int library)
 | 
							public Task DelteLibrary(int library)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _libraries.Delete(library);
 | 
								return LibraryRepository.Delete(library);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task DeleteCollection(int collection)
 | 
							public Task DeleteCollection(int collection)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _collections.Delete(collection);
 | 
								return CollectionRepository.Delete(collection);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task DeleteShow(int show)
 | 
							public Task DeleteShow(int show)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _shows.Delete(show);
 | 
								return ShowRepository.Delete(show);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task DeleteSeason(int season)
 | 
							public Task DeleteSeason(int season)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _seasons.Delete(season);
 | 
								return SeasonRepository.Delete(season);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task DeleteEpisode(int episode)
 | 
							public Task DeleteEpisode(int episode)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _episodes.Delete(episode);
 | 
								return EpisodeRepository.Delete(episode);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task DeleteTrack(int track)
 | 
							public Task DeleteTrack(int track)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _tracks.Delete(track);
 | 
								return TrackRepository.Delete(track);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task DeleteGenre(int genre)
 | 
							public Task DeleteGenre(int genre)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _genres.Delete(genre);
 | 
								return GenreRepository.Delete(genre);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task DeleteStudio(int studio)
 | 
							public Task DeleteStudio(int studio)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _studios.Delete(studio);
 | 
								return StudioRepository.Delete(studio);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task DeletePeople(int people)
 | 
							public Task DeletePeople(int people)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return _people.Delete(people);
 | 
								return PeopleRepository.Delete(people);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,12 +1,15 @@
 | 
				
			|||||||
using System;
 | 
					using System;
 | 
				
			||||||
using System.Collections.Generic;
 | 
					using System.Collections.Generic;
 | 
				
			||||||
using System.Linq;
 | 
					using System.Linq;
 | 
				
			||||||
 | 
					using System.Linq.Expressions;
 | 
				
			||||||
 | 
					using System.Runtime.InteropServices;
 | 
				
			||||||
using System.Threading.Tasks;
 | 
					using System.Threading.Tasks;
 | 
				
			||||||
using Kyoo.Controllers;
 | 
					using Kyoo.Controllers;
 | 
				
			||||||
using Kyoo.Models;
 | 
					using Kyoo.Models;
 | 
				
			||||||
using Kyoo.Models.Exceptions;
 | 
					using Kyoo.Models.Exceptions;
 | 
				
			||||||
using Microsoft.AspNetCore.Authorization;
 | 
					using Microsoft.AspNetCore.Authorization;
 | 
				
			||||||
using Microsoft.AspNetCore.Mvc;
 | 
					using Microsoft.AspNetCore.Mvc;
 | 
				
			||||||
 | 
					using Microsoft.AspNetCore.Mvc.RazorPages;
 | 
				
			||||||
using Microsoft.Extensions.Configuration;
 | 
					using Microsoft.Extensions.Configuration;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Kyoo.CommonApi
 | 
					namespace Kyoo.CommonApi
 | 
				
			||||||
@ -50,15 +53,13 @@ namespace Kyoo.CommonApi
 | 
				
			|||||||
		[HttpGet]
 | 
							[HttpGet]
 | 
				
			||||||
		[Authorize(Policy = "Read")]
 | 
							[Authorize(Policy = "Read")]
 | 
				
			||||||
		public async Task<ActionResult<Page<T>>> GetAll([FromQuery] string sortBy,
 | 
							public async Task<ActionResult<Page<T>>> GetAll([FromQuery] string sortBy,
 | 
				
			||||||
			[FromQuery] int limit,
 | 
					 | 
				
			||||||
			[FromQuery] int afterID,
 | 
								[FromQuery] int afterID,
 | 
				
			||||||
			[FromQuery] Dictionary<string, string> where)
 | 
								[FromQuery] Dictionary<string, string> where,
 | 
				
			||||||
 | 
								[FromQuery] int limit = 20)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			where.Remove("sortBy");
 | 
								where.Remove("sortBy");
 | 
				
			||||||
			where.Remove("limit");
 | 
								where.Remove("limit");
 | 
				
			||||||
			where.Remove("afterID");
 | 
								where.Remove("afterID");
 | 
				
			||||||
			if (limit == 0)
 | 
					 | 
				
			||||||
				limit = 20;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
			try
 | 
								try
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
@ -66,10 +67,7 @@ namespace Kyoo.CommonApi
 | 
				
			|||||||
					new Sort<T>(sortBy),
 | 
										new Sort<T>(sortBy),
 | 
				
			||||||
					new Pagination(limit, afterID));
 | 
										new Pagination(limit, afterID));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				return new Page<T>(ressources,
 | 
									return Page(ressources, limit);
 | 
				
			||||||
					_baseURL + Request.Path,
 | 
					 | 
				
			||||||
					Request.Query.ToDictionary(x => x.Key, x => x.Value.ToString(), StringComparer.InvariantCultureIgnoreCase),
 | 
					 | 
				
			||||||
					limit);
 | 
					 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			catch (ArgumentException ex)
 | 
								catch (ArgumentException ex)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
@ -77,6 +75,15 @@ namespace Kyoo.CommonApi
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							protected Page<TResult> Page<TResult>(ICollection<TResult> ressources, int limit)
 | 
				
			||||||
 | 
								where TResult : IRessource
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								return new Page<TResult>(ressources, 
 | 
				
			||||||
 | 
									_baseURL + Request.Path,
 | 
				
			||||||
 | 
									Request.Query.ToDictionary(x => x.Key, x => x.Value.ToString(), StringComparer.InvariantCultureIgnoreCase),
 | 
				
			||||||
 | 
									limit);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		[HttpPost]
 | 
							[HttpPost]
 | 
				
			||||||
		[Authorize(Policy = "Write")]
 | 
							[Authorize(Policy = "Write")]
 | 
				
			||||||
		public async Task<ActionResult<T>> Create([FromBody] T ressource)
 | 
							public async Task<ActionResult<T>> Create([FromBody] T ressource)
 | 
				
			||||||
@ -91,6 +98,20 @@ namespace Kyoo.CommonApi
 | 
				
			|||||||
				return Conflict(existing);
 | 
									return Conflict(existing);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							[HttpPut]
 | 
				
			||||||
 | 
							[Authorize(Policy = "Write")]
 | 
				
			||||||
 | 
							public async Task<ActionResult<T>> Edit([FromQuery] bool resetOld, [FromBody] T ressource)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								if (ressource.ID <= 0)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									T old = await _repository.Get(ressource.Slug);
 | 
				
			||||||
 | 
									if (old == null)
 | 
				
			||||||
 | 
										return NotFound();
 | 
				
			||||||
 | 
									ressource.ID = old.ID;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								return await _repository.Edit(ressource, resetOld);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		[HttpPut("{id}")]
 | 
							[HttpPut("{id}")]
 | 
				
			||||||
		[Authorize(Policy = "Write")]
 | 
							[Authorize(Policy = "Write")]
 | 
				
			||||||
 | 
				
			|||||||
@ -6,6 +6,7 @@
 | 
				
			|||||||
		<RootNamespace>Kyoo.CommonApi</RootNamespace>
 | 
							<RootNamespace>Kyoo.CommonApi</RootNamespace>
 | 
				
			||||||
		<PackageId>Kyoo.CommonApi</PackageId>
 | 
							<PackageId>Kyoo.CommonApi</PackageId>
 | 
				
			||||||
		<Authors>AnonymusRaccoon</Authors>
 | 
							<Authors>AnonymusRaccoon</Authors>
 | 
				
			||||||
 | 
							<OutputType>Library</OutputType>
 | 
				
			||||||
	</PropertyGroup>
 | 
						</PropertyGroup>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	<ItemGroup>
 | 
						<ItemGroup>
 | 
				
			||||||
 | 
				
			|||||||
@ -45,12 +45,18 @@ namespace Kyoo.Controllers
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		public abstract Task<ICollection<T>> Search(string query);
 | 
							public abstract Task<ICollection<T>> Search(string query);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public virtual async Task<ICollection<T>> GetAll(Expression<Func<T, bool>> where = null,
 | 
							public Task<ICollection<T>> GetAll(Expression<Func<T, bool>> where = null,
 | 
				
			||||||
 | 
								Sort<T> sort = default,
 | 
				
			||||||
 | 
								Pagination limit = default)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								return ApplyFilters(_database.Set<T>(), where, sort, limit);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							protected async Task<ICollection<T>> ApplyFilters(IQueryable<T> query,
 | 
				
			||||||
 | 
								Expression<Func<T, bool>> where = null,
 | 
				
			||||||
			Sort<T> sort = default, 
 | 
								Sort<T> sort = default, 
 | 
				
			||||||
			Pagination limit = default)
 | 
								Pagination limit = default)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			IQueryable<T> query = _database.Set<T>();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			if (where != null)
 | 
								if (where != null)
 | 
				
			||||||
				query = query.Where(where);
 | 
									query = query.Where(where);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -102,14 +102,26 @@ namespace Kyoo.Controllers
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		public async Task<ICollection<Season>> GetSeasons(int showID)
 | 
							public Task<ICollection<Season>> GetSeasons(int showID,
 | 
				
			||||||
 | 
								Expression<Func<Season, bool>> where = null, 
 | 
				
			||||||
 | 
								Sort<Season> sort = default,
 | 
				
			||||||
 | 
								Pagination limit = default)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return await _database.Seasons.Where(x => x.ShowID == showID).ToListAsync();
 | 
								return ApplyFilters(_database.Seasons.Where(x => x.ShowID == showID),
 | 
				
			||||||
 | 
									where,
 | 
				
			||||||
 | 
									sort,
 | 
				
			||||||
 | 
									limit);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public async Task<ICollection<Season>> GetSeasons(string showSlug)
 | 
							public Task<ICollection<Season>> GetSeasons(string showSlug,
 | 
				
			||||||
 | 
								Expression<Func<Season, bool>> where = null, 
 | 
				
			||||||
 | 
								Sort<Season> sort = default,
 | 
				
			||||||
 | 
								Pagination limit = default)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return await _database.Seasons.Where(x => x.Show.Slug == showSlug).ToListAsync();
 | 
								return ApplyFilters(_database.Seasons.Where(x => x.Show.Slug == showSlug),
 | 
				
			||||||
 | 
									where,
 | 
				
			||||||
 | 
									sort,
 | 
				
			||||||
 | 
									limit);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		public async Task Delete(string showSlug, int seasonNumber)
 | 
							public async Task Delete(string showSlug, int seasonNumber)
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,7 @@
 | 
				
			|||||||
using System;
 | 
					using System;
 | 
				
			||||||
using System.Reflection;
 | 
					using System.Reflection;
 | 
				
			||||||
using IdentityServer4.Services;
 | 
					using IdentityServer4.Services;
 | 
				
			||||||
using Kyoo.API;
 | 
					using Kyoo.Api;
 | 
				
			||||||
using Kyoo.Controllers;
 | 
					using Kyoo.Controllers;
 | 
				
			||||||
using Kyoo.Models;
 | 
					using Kyoo.Models;
 | 
				
			||||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
 | 
					using Microsoft.AspNetCore.Authentication.JwtBearer;
 | 
				
			||||||
 | 
				
			|||||||
@ -16,7 +16,7 @@ using Microsoft.AspNetCore.StaticFiles;
 | 
				
			|||||||
using Microsoft.Extensions.Configuration;
 | 
					using Microsoft.Extensions.Configuration;
 | 
				
			||||||
using SignInResult = Microsoft.AspNetCore.Identity.SignInResult;
 | 
					using SignInResult = Microsoft.AspNetCore.Identity.SignInResult;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Kyoo.API
 | 
					namespace Kyoo.Api
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	public class RegisterRequest
 | 
						public class RegisterRequest
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
 | 
				
			|||||||
@ -1,33 +1,20 @@
 | 
				
			|||||||
using Kyoo.Controllers;
 | 
					using Kyoo.Controllers;
 | 
				
			||||||
using Kyoo.Models;
 | 
					using Kyoo.Models;
 | 
				
			||||||
using Microsoft.AspNetCore.Mvc;
 | 
					using Microsoft.AspNetCore.Mvc;
 | 
				
			||||||
using System.Collections.Generic;
 | 
					 | 
				
			||||||
using System.Threading.Tasks;
 | 
					using System.Threading.Tasks;
 | 
				
			||||||
 | 
					using Kyoo.CommonApi;
 | 
				
			||||||
using Microsoft.AspNetCore.Authorization;
 | 
					using Microsoft.AspNetCore.Authorization;
 | 
				
			||||||
 | 
					using Microsoft.Extensions.Configuration;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Kyoo.API
 | 
					namespace Kyoo.Api
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	[Route("api/[controller]")]
 | 
						[Route("api/collection")]
 | 
				
			||||||
 | 
						[Route("api/collections")]
 | 
				
			||||||
	[ApiController]
 | 
						[ApiController]
 | 
				
			||||||
	public class CollectionController : ControllerBase
 | 
						public class CollectionApi : CrudApi<Collection>
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		private readonly ILibraryManager _libraryManager;
 | 
							public CollectionApi(ICollectionRepository repository, IConfiguration configuration) 
 | 
				
			||||||
 | 
								: base(repository, configuration)
 | 
				
			||||||
		public CollectionController(ILibraryManager libraryManager)
 | 
							{ }
 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			_libraryManager = libraryManager;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		[HttpGet("{collectionSlug}")]
 | 
					 | 
				
			||||||
		[Authorize(Policy="Read")]
 | 
					 | 
				
			||||||
		public async Task<ActionResult<Collection>> GetShows(string collectionSlug)
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			Collection collection = await _libraryManager.GetCollection(collectionSlug);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			if (collection == null)
 | 
					 | 
				
			||||||
				return NotFound();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			return collection;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -6,7 +6,7 @@ using System.Threading.Tasks;
 | 
				
			|||||||
using Kyoo.Controllers;
 | 
					using Kyoo.Controllers;
 | 
				
			||||||
using Microsoft.AspNetCore.Authorization;
 | 
					using Microsoft.AspNetCore.Authorization;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Kyoo.API
 | 
					namespace Kyoo.Api
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	[Route("api/[controller]")]
 | 
						[Route("api/[controller]")]
 | 
				
			||||||
	[ApiController]
 | 
						[ApiController]
 | 
				
			||||||
 | 
				
			|||||||
@ -5,7 +5,7 @@ using Kyoo.Controllers;
 | 
				
			|||||||
using Kyoo.Models;
 | 
					using Kyoo.Models;
 | 
				
			||||||
using Microsoft.AspNetCore.Mvc;
 | 
					using Microsoft.AspNetCore.Mvc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Kyoo.API
 | 
					namespace Kyoo.Api
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	[Route("api/genres")]
 | 
						[Route("api/genres")]
 | 
				
			||||||
	[Route("api/genre")]
 | 
						[Route("api/genre")]
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@ using System.Linq;
 | 
				
			|||||||
using System.Threading.Tasks;
 | 
					using System.Threading.Tasks;
 | 
				
			||||||
using Microsoft.AspNetCore.Authorization;
 | 
					using Microsoft.AspNetCore.Authorization;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Kyoo.API
 | 
					namespace Kyoo.Api
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	[Route("api/libraries")]
 | 
						[Route("api/libraries")]
 | 
				
			||||||
	[Route("api/library")]
 | 
						[Route("api/library")]
 | 
				
			||||||
 | 
				
			|||||||
@ -5,7 +5,7 @@ using Kyoo.Models;
 | 
				
			|||||||
using Microsoft.AspNetCore.Authorization;
 | 
					using Microsoft.AspNetCore.Authorization;
 | 
				
			||||||
using Microsoft.AspNetCore.Mvc;
 | 
					using Microsoft.AspNetCore.Mvc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Kyoo.API
 | 
					namespace Kyoo.Api
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	[Route("api/[controller]")]
 | 
						[Route("api/[controller]")]
 | 
				
			||||||
	[ApiController]
 | 
						[ApiController]
 | 
				
			||||||
 | 
				
			|||||||
@ -3,7 +3,7 @@ using Kyoo.Models;
 | 
				
			|||||||
using Microsoft.AspNetCore.Authorization;
 | 
					using Microsoft.AspNetCore.Authorization;
 | 
				
			||||||
using Microsoft.AspNetCore.Mvc;
 | 
					using Microsoft.AspNetCore.Mvc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Kyoo.API
 | 
					namespace Kyoo.Api
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	[Route("api/provider")]
 | 
						[Route("api/provider")]
 | 
				
			||||||
	[Route("api/providers")]
 | 
						[Route("api/providers")]
 | 
				
			||||||
 | 
				
			|||||||
@ -4,7 +4,7 @@ using Kyoo.Models;
 | 
				
			|||||||
using Microsoft.AspNetCore.Authorization;
 | 
					using Microsoft.AspNetCore.Authorization;
 | 
				
			||||||
using Microsoft.AspNetCore.Mvc;
 | 
					using Microsoft.AspNetCore.Mvc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Kyoo.API
 | 
					namespace Kyoo.Api
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	[Route("api/[controller]")]
 | 
						[Route("api/[controller]")]
 | 
				
			||||||
	[ApiController]
 | 
						[ApiController]
 | 
				
			||||||
 | 
				
			|||||||
@ -1,21 +0,0 @@
 | 
				
			|||||||
using System;
 | 
					 | 
				
			||||||
using Kyoo.Models;
 | 
					 | 
				
			||||||
using Microsoft.AspNetCore.Mvc;
 | 
					 | 
				
			||||||
using System.Collections.Generic;
 | 
					 | 
				
			||||||
using System.Linq;
 | 
					 | 
				
			||||||
using System.Threading.Tasks;
 | 
					 | 
				
			||||||
using Kyoo.Controllers;
 | 
					 | 
				
			||||||
using Kyoo.Models.Exceptions;
 | 
					 | 
				
			||||||
using Microsoft.AspNetCore.Authorization;
 | 
					 | 
				
			||||||
using Microsoft.Extensions.Configuration;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace Kyoo.API
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	[Route("api/shows")]
 | 
					 | 
				
			||||||
	[Route("api/show")]
 | 
					 | 
				
			||||||
	[ApiController]
 | 
					 | 
				
			||||||
	public class ShowsAPI : ControllerBase
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
							
								
								
									
										85
									
								
								Kyoo/Views/API/ShowsApi.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										85
									
								
								Kyoo/Views/API/ShowsApi.cs
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,85 @@
 | 
				
			|||||||
 | 
					using System;
 | 
				
			||||||
 | 
					using Kyoo.Models;
 | 
				
			||||||
 | 
					using Microsoft.AspNetCore.Mvc;
 | 
				
			||||||
 | 
					using System.Collections.Generic;
 | 
				
			||||||
 | 
					using System.Threading.Tasks;
 | 
				
			||||||
 | 
					using Kyoo.CommonApi;
 | 
				
			||||||
 | 
					using Kyoo.Controllers;
 | 
				
			||||||
 | 
					using Microsoft.AspNetCore.Authorization;
 | 
				
			||||||
 | 
					using Microsoft.Extensions.Configuration;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Kyoo.Api
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						[Route("api/show")]
 | 
				
			||||||
 | 
						[Route("api/shows")]
 | 
				
			||||||
 | 
						[ApiController]
 | 
				
			||||||
 | 
						public class ShowsApi : CrudApi<Show>
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							private readonly ILibraryManager _libraryManager;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							public ShowsApi(ILibraryManager libraryManager,
 | 
				
			||||||
 | 
								IConfiguration configuration)
 | 
				
			||||||
 | 
								: base(libraryManager.ShowRepository, configuration)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								_libraryManager = libraryManager;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							[HttpGet("{showID}/season")]
 | 
				
			||||||
 | 
							[HttpGet("{showID}/seasons")]
 | 
				
			||||||
 | 
							[Authorize(Policy = "Read")]
 | 
				
			||||||
 | 
							public async Task<ActionResult<Page<Season>>> GetSeasons(int showID,
 | 
				
			||||||
 | 
								[FromQuery] string sortBy,
 | 
				
			||||||
 | 
								[FromQuery] int limit,
 | 
				
			||||||
 | 
								[FromQuery] int afterID,
 | 
				
			||||||
 | 
								[FromQuery] Dictionary<string, string> where)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								where.Remove("showID");
 | 
				
			||||||
 | 
								where.Remove("sortBy");
 | 
				
			||||||
 | 
								where.Remove("limit");
 | 
				
			||||||
 | 
								where.Remove("afterID");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								try
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									ICollection<Season> ressources = await _libraryManager.GetSeasons(showID,
 | 
				
			||||||
 | 
										ApiHelper.ParseWhere<Season>(where),
 | 
				
			||||||
 | 
										new Sort<Season>(sortBy),
 | 
				
			||||||
 | 
										new Pagination(limit, afterID));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									return Page(ressources, limit);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								catch (ArgumentException ex)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									return BadRequest(new {Error = ex.Message});
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							[HttpGet("{slug}/season")]
 | 
				
			||||||
 | 
							[HttpGet("{slug}/seasons")]
 | 
				
			||||||
 | 
							[Authorize(Policy = "Read")]
 | 
				
			||||||
 | 
							public async Task<ActionResult<Page<Season>>> GetSeasons(string slug,
 | 
				
			||||||
 | 
								[FromQuery] string sortBy,
 | 
				
			||||||
 | 
								[FromQuery] int limit,
 | 
				
			||||||
 | 
								[FromQuery] int afterID,
 | 
				
			||||||
 | 
								[FromQuery] Dictionary<string, string> where)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								where.Remove("slug");
 | 
				
			||||||
 | 
								where.Remove("sortBy");
 | 
				
			||||||
 | 
								where.Remove("limit");
 | 
				
			||||||
 | 
								where.Remove("afterID");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								try
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									ICollection<Season> ressources = await _libraryManager.GetSeasons(slug,
 | 
				
			||||||
 | 
										ApiHelper.ParseWhere<Season>(where),
 | 
				
			||||||
 | 
										new Sort<Season>(sortBy),
 | 
				
			||||||
 | 
										new Pagination(limit, afterID));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									return Page(ressources, limit);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								catch (ArgumentException ex)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									return BadRequest(new {Error = ex.Message});
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -5,7 +5,7 @@ using Kyoo.Controllers;
 | 
				
			|||||||
using Kyoo.Models;
 | 
					using Kyoo.Models;
 | 
				
			||||||
using Microsoft.AspNetCore.Mvc;
 | 
					using Microsoft.AspNetCore.Mvc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Kyoo.API
 | 
					namespace Kyoo.Api
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	[Route("api/studios")]
 | 
						[Route("api/studios")]
 | 
				
			||||||
	[Route("api/studio")]
 | 
						[Route("api/studio")]
 | 
				
			||||||
 | 
				
			|||||||
@ -8,7 +8,7 @@ using Kyoo.Controllers;
 | 
				
			|||||||
using Kyoo.Models.Watch;
 | 
					using Kyoo.Models.Watch;
 | 
				
			||||||
using Microsoft.AspNetCore.Authorization;
 | 
					using Microsoft.AspNetCore.Authorization;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Kyoo.API
 | 
					namespace Kyoo.Api
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	[Route("[controller]")]
 | 
						[Route("[controller]")]
 | 
				
			||||||
	[ApiController]
 | 
						[ApiController]
 | 
				
			||||||
 | 
				
			|||||||
@ -2,7 +2,7 @@
 | 
				
			|||||||
using Kyoo.Controllers;
 | 
					using Kyoo.Controllers;
 | 
				
			||||||
using Microsoft.AspNetCore.Authorization;
 | 
					using Microsoft.AspNetCore.Authorization;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Kyoo.API
 | 
					namespace Kyoo.Api
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	[Route("api/[controller]")]
 | 
						[Route("api/[controller]")]
 | 
				
			||||||
	[ApiController]
 | 
						[ApiController]
 | 
				
			||||||
 | 
				
			|||||||
@ -5,7 +5,7 @@ using System.Threading.Tasks;
 | 
				
			|||||||
using Kyoo.Controllers;
 | 
					using Kyoo.Controllers;
 | 
				
			||||||
using Microsoft.AspNetCore.Authorization;
 | 
					using Microsoft.AspNetCore.Authorization;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Kyoo.API
 | 
					namespace Kyoo.Api
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	public class ThumbnailController : ControllerBase
 | 
						public class ThumbnailController : ControllerBase
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@ using System.IO;
 | 
				
			|||||||
using System.Threading.Tasks;
 | 
					using System.Threading.Tasks;
 | 
				
			||||||
using Microsoft.AspNetCore.Authorization;
 | 
					using Microsoft.AspNetCore.Authorization;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Kyoo.API
 | 
					namespace Kyoo.Api
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	[Route("[controller]")]
 | 
						[Route("[controller]")]
 | 
				
			||||||
	[ApiController]
 | 
						[ApiController]
 | 
				
			||||||
 | 
				
			|||||||
@ -4,7 +4,7 @@ using Kyoo.Models;
 | 
				
			|||||||
using Microsoft.AspNetCore.Authorization;
 | 
					using Microsoft.AspNetCore.Authorization;
 | 
				
			||||||
using Microsoft.AspNetCore.Mvc;
 | 
					using Microsoft.AspNetCore.Mvc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Kyoo.API
 | 
					namespace Kyoo.Api
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	[Route("api/[controller]")]
 | 
						[Route("api/[controller]")]
 | 
				
			||||||
	[ApiController]
 | 
						[ApiController]
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user