mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-12-09 21:39:37 +00:00
New model updates for series, collections, authors routes
This commit is contained in:
parent
73257188f6
commit
2d19208340
19 changed files with 432 additions and 247 deletions
|
|
@ -37,10 +37,10 @@ class UserCollection {
|
|||
}
|
||||
}
|
||||
|
||||
toJSONExpanded(audiobooks, minifiedBooks = false) {
|
||||
toJSONExpanded(libraryItems, minifiedBooks = false) {
|
||||
var json = this.toJSON()
|
||||
json.books = json.books.map(bookId => {
|
||||
var _ab = audiobooks.find(ab => ab.id === bookId)
|
||||
var _ab = libraryItems.find(li => li.id === bookId)
|
||||
return _ab ? minifiedBooks ? _ab.toJSONMinified() : _ab.toJSONExpanded() : null
|
||||
}).filter(b => !!b)
|
||||
return json
|
||||
|
|
|
|||
|
|
@ -99,11 +99,11 @@ class BookMetadata {
|
|||
return this.title + '&' + this.authorName
|
||||
}
|
||||
|
||||
hasAuthor(authorName) {
|
||||
return !!this.authors.find(au => au.name == authorName)
|
||||
hasAuthor(id) {
|
||||
return !!this.authors.find(au => au.id == id)
|
||||
}
|
||||
hasSeries(seriesName) {
|
||||
return !!this.series.find(se => se.name == seriesName)
|
||||
hasSeries(seriesId) {
|
||||
return !!this.series.find(se => se.id == seriesId)
|
||||
}
|
||||
hasNarrator(narratorName) {
|
||||
return this.narrators.includes(narratorName)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue