mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-12-10 05:49:37 +00:00
Update library collections api endpoint to use libraryItems from db
This commit is contained in:
parent
aac2879652
commit
38029d1202
8 changed files with 209 additions and 31 deletions
|
|
@ -661,13 +661,23 @@ module.exports = (sequelize) => {
|
|||
* Get book library items for author, optional use user permissions
|
||||
* @param {oldAuthor} author
|
||||
* @param {[oldUser]} user
|
||||
* @returns {oldLibraryItem[]}
|
||||
* @returns {Promise<oldLibraryItem[]>}
|
||||
*/
|
||||
static async getForAuthor(author, user = null) {
|
||||
const { libraryItems } = await libraryFilters.getLibraryItemsForAuthor(author, user, undefined, undefined)
|
||||
return libraryItems.map(li => this.getOldLibraryItem(li))
|
||||
}
|
||||
|
||||
/**
|
||||
* Get book library items in a collection
|
||||
* @param {oldCollection} collection
|
||||
* @returns {Promise<oldLibraryItem[]>}
|
||||
*/
|
||||
static async getForCollection(collection) {
|
||||
const libraryItems = await libraryFilters.getLibraryItemsForCollection(collection)
|
||||
return libraryItems.map(li => this.getOldLibraryItem(li))
|
||||
}
|
||||
|
||||
getMedia(options) {
|
||||
if (!this.mediaType) return Promise.resolve(null)
|
||||
const mixinMethodName = `get${sequelize.uppercaseFirst(this.mediaType)}`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue