mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-25 21:35:07 +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:
parent
e50bd93958
commit
4c68ad46f4
10 changed files with 105 additions and 78 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue