Migrate Feed updating and build xml to new model

This commit is contained in:
advplyr 2024-12-15 16:56:59 -06:00
parent 369c05936b
commit f8fbd3ac8c
10 changed files with 373 additions and 426 deletions

View file

@ -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