mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-03 01:35:08 +02:00
Update:Rename UserCollections to Collections
This commit is contained in:
parent
fdf67e17a0
commit
4cbc8676c6
11 changed files with 30 additions and 37 deletions
|
@ -4,7 +4,7 @@ const Logger = require('./Logger')
|
|||
const { version } = require('../package.json')
|
||||
const LibraryItem = require('./objects/LibraryItem')
|
||||
const User = require('./objects/user/User')
|
||||
const UserCollection = require('./objects/UserCollection')
|
||||
const Collection = require('./objects/Collection')
|
||||
const Library = require('./objects/Library')
|
||||
const Author = require('./objects/entities/Author')
|
||||
const Series = require('./objects/entities/Series')
|
||||
|
@ -180,7 +180,7 @@ class Db {
|
|||
}
|
||||
})
|
||||
var p5 = this.collectionsDb.select(() => true).then((results) => {
|
||||
this.collections = results.data.map(l => new UserCollection(l))
|
||||
this.collections = results.data.map(l => new Collection(l))
|
||||
Logger.info(`[DB] ${this.collections.length} Collections Loaded`)
|
||||
})
|
||||
var p6 = this.authorsDb.select(() => true).then((results) => {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
const Logger = require('../Logger')
|
||||
const UserCollection = require('../objects/UserCollection')
|
||||
const Collection = require('../objects/Collection')
|
||||
|
||||
class CollectionController {
|
||||
constructor() { }
|
||||
|
||||
async create(req, res) {
|
||||
var newCollection = new UserCollection()
|
||||
var newCollection = new Collection()
|
||||
req.body.userId = req.user.id
|
||||
var success = newCollection.setData(req.body)
|
||||
if (!success) {
|
||||
|
|
|
@ -105,13 +105,6 @@ class UserController {
|
|||
}
|
||||
var user = req.reqUser
|
||||
|
||||
// delete user collections
|
||||
var userCollections = this.db.collections.filter(c => c.userId === user.id)
|
||||
var collectionsToRemove = userCollections.map(uc => uc.id)
|
||||
for (let i = 0; i < collectionsToRemove.length; i++) {
|
||||
await this.db.removeEntity('collection', collectionsToRemove[i])
|
||||
}
|
||||
|
||||
// Todo: check if user is logged in and cancel streams
|
||||
|
||||
var userJson = user.toJSONForBrowser()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Logger = require('../Logger')
|
||||
const { getId } = require('../utils/index')
|
||||
|
||||
class UserCollection {
|
||||
class Collection {
|
||||
constructor(collection) {
|
||||
this.id = null
|
||||
this.libraryId = null
|
||||
|
@ -105,4 +105,4 @@ class UserCollection {
|
|||
return hasUpdates
|
||||
}
|
||||
}
|
||||
module.exports = UserCollection
|
||||
module.exports = Collection
|
Loading…
Add table
Add a link
Reference in a new issue