mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-06-28 19:50:23 +02:00
Init sqlite take 2
This commit is contained in:
parent
d86a3b3dc2
commit
cf7fd315b6
88 changed files with 7017 additions and 692 deletions
|
@ -5,6 +5,7 @@ const MediaProgress = require('./MediaProgress')
|
|||
class User {
|
||||
constructor(user) {
|
||||
this.id = null
|
||||
this.oldUserId = null // TODO: Temp for keeping old access tokens
|
||||
this.username = null
|
||||
this.pash = null
|
||||
this.type = null
|
||||
|
@ -73,6 +74,7 @@ class User {
|
|||
toJSON() {
|
||||
return {
|
||||
id: this.id,
|
||||
oldUserId: this.oldUserId,
|
||||
username: this.username,
|
||||
pash: this.pash,
|
||||
type: this.type,
|
||||
|
@ -93,6 +95,7 @@ class User {
|
|||
toJSONForBrowser(hideRootToken = false, minimal = false) {
|
||||
const json = {
|
||||
id: this.id,
|
||||
oldUserId: this.oldUserId,
|
||||
username: this.username,
|
||||
type: this.type,
|
||||
token: (this.type === 'root' && hideRootToken) ? '' : this.token,
|
||||
|
@ -126,6 +129,7 @@ class User {
|
|||
}
|
||||
return {
|
||||
id: this.id,
|
||||
oldUserId: this.oldUserId,
|
||||
username: this.username,
|
||||
type: this.type,
|
||||
session,
|
||||
|
@ -137,6 +141,7 @@ class User {
|
|||
|
||||
construct(user) {
|
||||
this.id = user.id
|
||||
this.oldUserId = user.oldUserId
|
||||
this.username = user.username
|
||||
this.pash = user.pash
|
||||
this.type = user.type
|
||||
|
@ -320,7 +325,7 @@ class User {
|
|||
if (!itemProgress) {
|
||||
const newItemProgress = new MediaProgress()
|
||||
|
||||
newItemProgress.setData(libraryItem.id, updatePayload, episodeId)
|
||||
newItemProgress.setData(libraryItem, updatePayload, episodeId, this.id)
|
||||
this.mediaProgress.push(newItemProgress)
|
||||
return true
|
||||
}
|
||||
|
@ -336,12 +341,6 @@ class User {
|
|||
return true
|
||||
}
|
||||
|
||||
removeMediaProgressForLibraryItem(libraryItemId) {
|
||||
if (!this.mediaProgress.some(lip => lip.libraryItemId == libraryItemId)) return false
|
||||
this.mediaProgress = this.mediaProgress.filter(lip => lip.libraryItemId != libraryItemId)
|
||||
return true
|
||||
}
|
||||
|
||||
checkCanAccessLibrary(libraryId) {
|
||||
if (this.permissions.accessAllLibraries) return true
|
||||
if (!this.librariesAccessible) return false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue