mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-10 03:11:34 +00:00
updated getAllOldLibraryItems to grab subset of eps
updated getAllOldLibraryItems to grab only the episodes in the playlist not every podcast episode from the podcast
This commit is contained in:
parent
45f8b06d56
commit
875e6cabe8
1 changed files with 14 additions and 6 deletions
|
|
@ -10,6 +10,7 @@ const { filePathToPOSIX, getFileTimestampsWithIno } = require('../utils/fileUtil
|
||||||
const LibraryFile = require('../objects/files/LibraryFile')
|
const LibraryFile = require('../objects/files/LibraryFile')
|
||||||
const Book = require('./Book')
|
const Book = require('./Book')
|
||||||
const Podcast = require('./Podcast')
|
const Podcast = require('./Podcast')
|
||||||
|
const { Op } = require('sequelize');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef LibraryFileObject
|
* @typedef LibraryFileObject
|
||||||
|
|
@ -124,9 +125,13 @@ class LibraryItem extends Model {
|
||||||
* @param {import('sequelize').WhereOptions} [where]
|
* @param {import('sequelize').WhereOptions} [where]
|
||||||
* @returns {Array<objects.LibraryItem>} old library items
|
* @returns {Array<objects.LibraryItem>} old library items
|
||||||
*/
|
*/
|
||||||
static async getAllOldLibraryItems(where = null) {
|
static async getAllOldLibraryItems({ id: libraryItemIds, episodeIds }) {
|
||||||
let libraryItems = await this.findAll({
|
let libraryItems = await this.findAll({
|
||||||
where,
|
where: {
|
||||||
|
id: {
|
||||||
|
[Op.in]: libraryItemIds
|
||||||
|
}
|
||||||
|
},
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
model: this.sequelize.models.book,
|
model: this.sequelize.models.book,
|
||||||
|
|
@ -147,11 +152,14 @@ class LibraryItem extends Model {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
model: this.sequelize.models.podcast,
|
model: this.sequelize.models.podcast,
|
||||||
include: [
|
include: {
|
||||||
{
|
model: this.sequelize.models.podcastEpisode,
|
||||||
model: this.sequelize.models.podcastEpisode
|
where: {
|
||||||
|
id: {
|
||||||
|
[Op.in]: episodeIds
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue