mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-18 10:59:41 +02:00
Update db model references
This commit is contained in:
@@ -116,7 +116,7 @@ class Server {
|
||||
await this.logManager.init()
|
||||
await this.rssFeedManager.init()
|
||||
|
||||
const libraries = await Database.models.library.getAllOldLibraries()
|
||||
const libraries = await Database.libraryModel.getAllOldLibraries()
|
||||
await this.cronManager.init(libraries)
|
||||
|
||||
if (Database.serverSettings.scannerDisableWatcher) {
|
||||
@@ -253,7 +253,7 @@ class Server {
|
||||
*/
|
||||
async cleanUserData() {
|
||||
// Get all media progress without an associated media item
|
||||
const mediaProgressToRemove = await Database.models.mediaProgress.findAll({
|
||||
const mediaProgressToRemove = await Database.mediaProgressModel.findAll({
|
||||
where: {
|
||||
'$podcastEpisode.id$': null,
|
||||
'$book.id$': null
|
||||
@@ -261,18 +261,18 @@ class Server {
|
||||
attributes: ['id'],
|
||||
include: [
|
||||
{
|
||||
model: Database.models.book,
|
||||
model: Database.bookModel,
|
||||
attributes: ['id']
|
||||
},
|
||||
{
|
||||
model: Database.models.podcastEpisode,
|
||||
model: Database.podcastEpisodeModel,
|
||||
attributes: ['id']
|
||||
}
|
||||
]
|
||||
})
|
||||
if (mediaProgressToRemove.length) {
|
||||
// Remove media progress
|
||||
const mediaProgressRemoved = await Database.models.mediaProgress.destroy({
|
||||
const mediaProgressRemoved = await Database.mediaProgressModel.destroy({
|
||||
where: {
|
||||
id: {
|
||||
[Sequelize.Op.in]: mediaProgressToRemove.map(mp => mp.id)
|
||||
@@ -285,7 +285,7 @@ class Server {
|
||||
}
|
||||
|
||||
// Remove series from hide from continue listening that no longer exist
|
||||
const users = await Database.models.user.getOldUsers()
|
||||
const users = await Database.userModel.getOldUsers()
|
||||
for (const _user of users) {
|
||||
let hasUpdated = false
|
||||
if (_user.seriesHideFromContinueListening.length) {
|
||||
|
Reference in New Issue
Block a user