2021-10-25 01:25:44 +02:00
|
|
|
class AudioBookmark {
|
|
|
|
constructor(bookmark) {
|
2022-03-16 00:57:15 +01:00
|
|
|
this.libraryItemId = null
|
2021-10-25 01:25:44 +02:00
|
|
|
this.title = null
|
|
|
|
this.time = null
|
|
|
|
this.createdAt = null
|
|
|
|
|
|
|
|
if (bookmark) {
|
|
|
|
this.construct(bookmark)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
toJSON() {
|
|
|
|
return {
|
2022-03-16 00:57:15 +01:00
|
|
|
libraryItemId: this.libraryItemId,
|
2021-10-25 01:25:44 +02:00
|
|
|
title: this.title || '',
|
|
|
|
time: this.time,
|
|
|
|
createdAt: this.createdAt
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
construct(bookmark) {
|
2022-03-16 00:57:15 +01:00
|
|
|
this.libraryItemId = bookmark.libraryItemId
|
2021-10-25 01:25:44 +02:00
|
|
|
this.title = bookmark.title || ''
|
|
|
|
this.time = bookmark.time || 0
|
|
|
|
this.createdAt = bookmark.createdAt
|
|
|
|
}
|
|
|
|
|
2022-03-16 00:57:15 +01:00
|
|
|
setData(libraryItemId, time, title) {
|
|
|
|
this.libraryItemId = libraryItemId
|
2021-10-25 01:25:44 +02:00
|
|
|
this.title = title
|
|
|
|
this.time = time
|
|
|
|
this.createdAt = Date.now()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
module.exports = AudioBookmark
|