mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-06-30 20:44:56 +02:00
Migrate Feed updating and build xml to new model
This commit is contained in:
parent
369c05936b
commit
f8fbd3ac8c
10 changed files with 373 additions and 426 deletions
|
@ -1,7 +1,6 @@
|
|||
const { DataTypes, Model, Sequelize } = require('sequelize')
|
||||
|
||||
const oldCollection = require('../objects/Collection')
|
||||
const Logger = require('../Logger')
|
||||
|
||||
class Collection extends Model {
|
||||
constructor(values, options) {
|
||||
|
@ -121,6 +120,39 @@ class Collection extends Model {
|
|||
.filter((c) => c)
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} collectionId
|
||||
* @returns {Promise<Collection>}
|
||||
*/
|
||||
static async getExpandedById(collectionId) {
|
||||
return this.findByPk(collectionId, {
|
||||
include: [
|
||||
{
|
||||
model: this.sequelize.models.book,
|
||||
include: [
|
||||
{
|
||||
model: this.sequelize.models.libraryItem
|
||||
},
|
||||
{
|
||||
model: this.sequelize.models.author,
|
||||
through: {
|
||||
attributes: []
|
||||
}
|
||||
},
|
||||
{
|
||||
model: this.sequelize.models.series,
|
||||
through: {
|
||||
attributes: ['sequence']
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
order: [[this.sequelize.models.book, this.sequelize.models.collectionBook, 'order', 'ASC']]
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Get old collection from Collection
|
||||
* @param {Collection} collectionExpanded
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue