mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-12-16 00:39:40 +00:00
Update bookmarks API endpoints to use new user model
This commit is contained in:
parent
9cd92c7b7f
commit
1923854202
3 changed files with 136 additions and 50 deletions
|
|
@ -450,37 +450,6 @@ class User {
|
|||
return this.checkCanAccessLibraryItemWithTags(tags)
|
||||
}
|
||||
|
||||
findBookmark(libraryItemId, time) {
|
||||
return this.bookmarks.find((bm) => bm.libraryItemId === libraryItemId && bm.time == time)
|
||||
}
|
||||
|
||||
createBookmark(libraryItemId, time, title) {
|
||||
var existingBookmark = this.findBookmark(libraryItemId, time)
|
||||
if (existingBookmark) {
|
||||
Logger.warn('[User] Create Bookmark already exists for this time')
|
||||
existingBookmark.title = title
|
||||
return existingBookmark
|
||||
}
|
||||
var newBookmark = new AudioBookmark()
|
||||
newBookmark.setData(libraryItemId, time, title)
|
||||
this.bookmarks.push(newBookmark)
|
||||
return newBookmark
|
||||
}
|
||||
|
||||
updateBookmark(libraryItemId, time, title) {
|
||||
var bookmark = this.findBookmark(libraryItemId, time)
|
||||
if (!bookmark) {
|
||||
Logger.error(`[User] updateBookmark not found`)
|
||||
return null
|
||||
}
|
||||
bookmark.title = title
|
||||
return bookmark
|
||||
}
|
||||
|
||||
removeBookmark(libraryItemId, time) {
|
||||
this.bookmarks = this.bookmarks.filter((bm) => bm.libraryItemId !== libraryItemId || bm.time !== time)
|
||||
}
|
||||
|
||||
checkShouldHideSeriesFromContinueListening(seriesId) {
|
||||
return this.seriesHideFromContinueListening.includes(seriesId)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue