Fixing studios & genres related items API

This commit is contained in:
Zoe Roux
2020-08-16 22:57:40 +02:00
parent b7bbc1a14c
commit b7a5b0579a
9 changed files with 132 additions and 22 deletions
@@ -46,6 +46,17 @@ namespace Kyoo.Controllers
Task<Genre> GetGenre(string slug);
Task<Studio> GetStudio(string slug);
Task<People> GetPeople(string slug);
// Get by predicate
Task<Library> GetLibrary(Expression<Func<Library, bool>> where);
Task<Collection> GetCollection(Expression<Func<Collection, bool>> where);
Task<Show> GetShow(Expression<Func<Show, bool>> where);
Task<Season> GetSeason(Expression<Func<Season, bool>> where);
Task<Episode> GetEpisode(Expression<Func<Episode, bool>> where);
Task<Track> GetTrack(Expression<Func<Track, bool>> where);
Task<Genre> GetGenre(Expression<Func<Genre, bool>> where);
Task<Studio> GetStudio(Expression<Func<Studio, bool>> where);
Task<People> GetPerson(Expression<Func<People, bool>> where);
// Get by relations
Task<ICollection<Season>> GetSeasonsFromShow(int showID,
+1
View File
@@ -78,6 +78,7 @@ namespace Kyoo.Controllers
{
Task<T> Get(int id);
Task<T> Get(string slug);
async Task<T> Get(Expression<Func<T, bool>> where) => (await GetAll(where, limit: 1)).FirstOrDefault();
Task<ICollection<T>> Search(string query);
Task<ICollection<T>> GetAll(Expression<Func<T, bool>> where = null,
@@ -175,6 +175,51 @@ namespace Kyoo.Controllers
return PeopleRepository.Get(slug);
}
public Task<Library> GetLibrary(Expression<Func<Library, bool>> where)
{
return LibraryRepository.Get(where);
}
public Task<Collection> GetCollection(Expression<Func<Collection, bool>> where)
{
return CollectionRepository.Get(where);
}
public Task<Show> GetShow(Expression<Func<Show, bool>> where)
{
return ShowRepository.Get(where);
}
public Task<Season> GetSeason(Expression<Func<Season, bool>> where)
{
return SeasonRepository.Get(where);
}
public Task<Episode> GetEpisode(Expression<Func<Episode, bool>> where)
{
return EpisodeRepository.Get(where);
}
public Task<Track> GetTrack(Expression<Func<Track, bool>> where)
{
return TrackRepository.Get(where);
}
public Task<Genre> GetGenre(Expression<Func<Genre, bool>> where)
{
return GenreRepository.Get(where);
}
public Task<Studio> GetStudio(Expression<Func<Studio, bool>> where)
{
return StudioRepository.Get(where);
}
public Task<People> GetPerson(Expression<Func<People, bool>> where)
{
return PeopleRepository.Get(where);
}
public Task<ICollection<Library>> GetLibraries(Expression<Func<Library, bool>> where = null,
Sort<Library> sort = default,
Pagination page = default)