Creating the collection's rest api

This commit is contained in:
Zoe Roux
2020-08-03 17:29:17 +02:00
parent 8af2cff1a2
commit 6a0fb2dd38
8 changed files with 331 additions and 42 deletions
+40 -2
View File
@@ -237,7 +237,6 @@ namespace Kyoo.Controllers
Expression<Func<LibraryItem, bool>> where = null,
Sort<LibraryItem> sort = default,
Pagination limit = default);
Task<ICollection<LibraryItem>> GetItemsFromLibrary(int id,
[Optional] Expression<Func<LibraryItem, bool>> where,
Expression<Func<LibraryItem, object>> sort,
@@ -248,12 +247,51 @@ namespace Kyoo.Controllers
Expression<Func<LibraryItem, bool>> where = null,
Sort<LibraryItem> sort = default,
Pagination limit = default);
Task<ICollection<LibraryItem>> GetItemsFromLibrary(string librarySlug,
[Optional] Expression<Func<LibraryItem, bool>> where,
Expression<Func<LibraryItem, object>> sort,
Pagination limit = default
) => GetItemsFromLibrary(librarySlug, where, new Sort<LibraryItem>(sort), limit);
Task<ICollection<Show>> GetShowsFromCollection(int id,
Expression<Func<Show, bool>> where = null,
Sort<Show> sort = default,
Pagination limit = default);
Task<ICollection<Show>> GetShowsFromCollection(int id,
[Optional] Expression<Func<Show, bool>> where,
Expression<Func<Show, object>> sort,
Pagination limit = default
) => GetShowsFromCollection(id, where, new Sort<Show>(sort), limit);
Task<ICollection<Show>> GetShowsFromCollection(string slug,
Expression<Func<Show, bool>> where = null,
Sort<Show> sort = default,
Pagination limit = default);
Task<ICollection<Show>> GetShowsFromCollection(string slug,
[Optional] Expression<Func<Show, bool>> where,
Expression<Func<Show, object>> sort,
Pagination limit = default
) => GetShowsFromCollection(slug, where, new Sort<Show>(sort), limit);
Task<ICollection<Library>> GetLibrariesFromCollection(int id,
Expression<Func<Library, bool>> where = null,
Sort<Library> sort = default,
Pagination limit = default);
Task<ICollection<Library>> GetLibrariesFromCollection(int id,
[Optional] Expression<Func<Library, bool>> where,
Expression<Func<Library, object>> sort,
Pagination limit = default
) => GetLibrariesFromCollection(id, where, new Sort<Library>(sort), limit);
Task<ICollection<Library>> GetLibrariesFromCollection(string slug,
Expression<Func<Library, bool>> where = null,
Sort<Library> sort = default,
Pagination limit = default);
Task<ICollection<Library>> GetLibrariesFromCollection(string slug,
[Optional] Expression<Func<Library, bool>> where,
Expression<Func<Library, object>> sort,
Pagination limit = default
) => GetLibrariesFromCollection(slug, where, new Sort<Library>(sort), limit);
// Helpers
+39 -19
View File
@@ -123,25 +123,25 @@ namespace Kyoo.Controllers
Pagination limit = default
) => GetFromLibrary(slug, where, new Sort<Show>(sort), limit);
// Task<ICollection<Show>> GetFromCollection(int id,
// Expression<Func<Show, bool>> where = null,
// Sort<Show> sort = default,
// Pagination limit = default);
// Task<ICollection<Show>> GetFromCollection(int id,
// [Optional] Expression<Func<Show, bool>> where,
// Expression<Func<Show, object>> sort,
// Pagination limit = default
// ) => GetFromCollection(id, where, new Sort<Show>(sort), limit);
//
// Task<ICollection<Show>> GetFromCollection(string slug,
// Expression<Func<Show, bool>> where = null,
// Sort<Show> sort = default,
// Pagination limit = default);
// Task<ICollection<Show>> GetFromCollection(string slug,
// [Optional] Expression<Func<Show, bool>> where,
// Expression<Func<Show, object>> sort,
// Pagination limit = default
// ) => GetFromCollection(slug, where, new Sort<Show>(sort), limit);
Task<ICollection<Show>> GetFromCollection(int id,
Expression<Func<Show, bool>> where = null,
Sort<Show> sort = default,
Pagination limit = default);
Task<ICollection<Show>> GetFromCollection(int id,
[Optional] Expression<Func<Show, bool>> where,
Expression<Func<Show, object>> sort,
Pagination limit = default
) => GetFromCollection(id, where, new Sort<Show>(sort), limit);
Task<ICollection<Show>> GetFromCollection(string slug,
Expression<Func<Show, bool>> where = null,
Sort<Show> sort = default,
Pagination limit = default);
Task<ICollection<Show>> GetFromCollection(string slug,
[Optional] Expression<Func<Show, bool>> where,
Expression<Func<Show, object>> sort,
Pagination limit = default
) => GetFromCollection(slug, where, new Sort<Show>(sort), limit);
}
public interface ISeasonRepository : IRepository<Season>
@@ -255,6 +255,26 @@ namespace Kyoo.Controllers
Expression<Func<Library, object>> sort,
Pagination limit = default
) => GetFromShow(showSlug, where, new Sort<Library>(sort), limit);
Task<ICollection<Library>> GetFromCollection(int id,
Expression<Func<Library, bool>> where = null,
Sort<Library> sort = default,
Pagination limit = default);
Task<ICollection<Library>> GetFromCollection(int id,
[Optional] Expression<Func<Library, bool>> where,
Expression<Func<Library, object>> sort,
Pagination limit = default
) => GetFromCollection(id, where, new Sort<Library>(sort), limit);
Task<ICollection<Library>> GetFromCollection(string slug,
Expression<Func<Library, bool>> where = null,
Sort<Library> sort = default,
Pagination limit = default);
Task<ICollection<Library>> GetFromCollection(string slug,
[Optional] Expression<Func<Library, bool>> where,
Expression<Func<Library, object>> sort,
Pagination limit = default
) => GetFromCollection(slug, where, new Sort<Library>(sort), limit);
}
public interface ILibraryItemRepository : IRepository<LibraryItem>
@@ -380,6 +380,38 @@ namespace Kyoo.Controllers
return LibraryItemRepository.GetFromLibrary(librarySlug, where, sort, limit);
}
public Task<ICollection<Show>> GetShowsFromCollection(int id,
Expression<Func<Show, bool>> where = null,
Sort<Show> sort = default,
Pagination limit = default)
{
return ShowRepository.GetFromCollection(id, where, sort, limit);
}
public Task<ICollection<Show>> GetShowsFromCollection(string slug,
Expression<Func<Show, bool>> where = null,
Sort<Show> sort = default,
Pagination limit = default)
{
return ShowRepository.GetFromCollection(slug, where, sort, limit);
}
public Task<ICollection<Library>> GetLibrariesFromCollection(int id,
Expression<Func<Library, bool>> where = null,
Sort<Library> sort = default,
Pagination limit = default)
{
return LibraryRepository.GetFromCollection(id, where, sort, limit);
}
public Task<ICollection<Library>> GetLibrariesFromCollection(string slug,
Expression<Func<Library, bool>> where = null,
Sort<Library> sort = default,
Pagination limit = default)
{
return LibraryRepository.GetFromCollection(slug, where, sort, limit);
}
public Task AddShowLink(int showID, int? libraryID, int? collectionID)
{
return ShowRepository.AddShowLink(showID, libraryID, collectionID);