mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-16 04:14:58 +02:00
Add:Delete playback session button and api route
This commit is contained in:
parent
1ad9ea92b6
commit
0c5db214d1
6 changed files with 94 additions and 21 deletions
23
server/Db.js
23
server/Db.js
|
@ -183,17 +183,6 @@ class Db {
|
|||
getLibraryItemsInLibrary(libraryId) {
|
||||
return this.libraryItems.filter(li => li.libraryId === libraryId)
|
||||
}
|
||||
getPlaybackSession(id) {
|
||||
return this.sessionsDb.select((pb) => pb.id == id).then((results) => {
|
||||
if (results.data.length) {
|
||||
return new PlaybackSession(results.data[0])
|
||||
}
|
||||
return null
|
||||
}).catch((error) => {
|
||||
Logger.error('Failed to get session', error)
|
||||
return null
|
||||
})
|
||||
}
|
||||
|
||||
async updateLibraryItem(libraryItem) {
|
||||
return this.updateLibraryItems([libraryItem])
|
||||
|
@ -452,6 +441,18 @@ class Db {
|
|||
})
|
||||
}
|
||||
|
||||
getPlaybackSession(id) {
|
||||
return this.sessionsDb.select((pb) => pb.id == id).then((results) => {
|
||||
if (results.data.length) {
|
||||
return new PlaybackSession(results.data[0])
|
||||
}
|
||||
return null
|
||||
}).catch((error) => {
|
||||
Logger.error('Failed to get session', error)
|
||||
return null
|
||||
})
|
||||
}
|
||||
|
||||
selectUserSessions(userId) {
|
||||
return this.sessionsDb.select((session) => session.userId === userId).then((results) => {
|
||||
return results.data || []
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue