New data model migration for users, bookmarks and playback sessions

This commit is contained in:
advplyr 2022-03-15 18:57:15 -05:00
parent 4c2ad3ede5
commit 68b13ae45f
17 changed files with 462 additions and 192 deletions

View file

@ -0,0 +1,36 @@
class AudioBookmark {
constructor(bookmark) {
this.libraryItemId = null
this.title = null
this.time = null
this.createdAt = null
if (bookmark) {
this.construct(bookmark)
}
}
toJSON() {
return {
libraryItemId: this.libraryItemId,
title: this.title || '',
time: this.time,
createdAt: this.createdAt
}
}
construct(bookmark) {
this.libraryItemId = bookmark.libraryItemId
this.title = bookmark.title || ''
this.time = bookmark.time || 0
this.createdAt = bookmark.createdAt
}
setData(libraryItemId, time, title) {
this.libraryItemId = libraryItemId
this.title = title
this.time = time
this.createdAt = Date.now()
}
}
module.exports = AudioBookmark