mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-16 18:11:00 +02:00
Refactor RssFeedManager to use new model when closing feeds, fix close series feed when series is removed, update RssFeedManager to singleton
This commit is contained in:
@ -124,12 +124,18 @@ class Feed extends Model {
|
||||
})
|
||||
}
|
||||
|
||||
static removeById(feedId) {
|
||||
return this.destroy({
|
||||
where: {
|
||||
id: feedId
|
||||
}
|
||||
})
|
||||
/**
|
||||
* @param {string} feedId
|
||||
* @returns {Promise<boolean>} - true if feed was removed
|
||||
*/
|
||||
static async removeById(feedId) {
|
||||
return (
|
||||
(await this.destroy({
|
||||
where: {
|
||||
id: feedId
|
||||
}
|
||||
})) > 0
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -163,22 +169,6 @@ class Feed extends Model {
|
||||
return this.getOldFeed(feedExpanded)
|
||||
}
|
||||
|
||||
/**
|
||||
* Find feed and return oldFeed
|
||||
* @param {string} id
|
||||
* @returns {Promise<oldFeed>} oldFeed
|
||||
*/
|
||||
static async findByPkOld(id) {
|
||||
if (!id) return null
|
||||
const feedExpanded = await this.findByPk(id, {
|
||||
include: {
|
||||
model: this.sequelize.models.feedEpisode
|
||||
}
|
||||
})
|
||||
if (!feedExpanded) return null
|
||||
return this.getOldFeed(feedExpanded)
|
||||
}
|
||||
|
||||
static async fullCreateFromOld(oldFeed) {
|
||||
const feedObj = this.getFromOld(oldFeed)
|
||||
const newFeed = await this.create(feedObj)
|
||||
|
Reference in New Issue
Block a user