mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-12-09 21:39:37 +00:00
Updates to LibraryController to use new Library model
- Additional validation on API endpoints - Removed success toast when reorder libraries
This commit is contained in:
parent
e0de59a4b6
commit
5d13faef33
12 changed files with 260 additions and 169 deletions
|
|
@ -301,6 +301,35 @@ class Library extends Model {
|
|||
}
|
||||
)
|
||||
}
|
||||
|
||||
get isPodcast() {
|
||||
return this.mediaType === 'podcast'
|
||||
}
|
||||
get isBook() {
|
||||
return this.mediaType === 'book'
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: Update to use new model
|
||||
*/
|
||||
toOldJSON() {
|
||||
return {
|
||||
id: this.id,
|
||||
name: this.name,
|
||||
folders: (this.libraryFolders || []).map((f) => f.toOldJSON()),
|
||||
displayOrder: this.displayOrder,
|
||||
icon: this.icon,
|
||||
mediaType: this.mediaType,
|
||||
provider: this.provider,
|
||||
settings: {
|
||||
...this.settings
|
||||
},
|
||||
lastScan: this.lastScan?.valueOf() || null,
|
||||
lastScanVersion: this.lastScanVersion,
|
||||
createdAt: this.createdAt.valueOf(),
|
||||
lastUpdate: this.updatedAt.valueOf()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Library
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue