Add infra to handle with feed healthy

This commit is contained in:
mfcar 2023-09-23 20:38:03 +01:00
parent 102c90c4e8
commit 2b3c3cd088
No known key found for this signature in database
6 changed files with 412 additions and 365 deletions

View file

@ -50,6 +50,10 @@ class Podcast extends Model {
this.createdAt
/** @type {Date} */
this.updatedAt
/** @type {Date} */
this.lastSuccessfulFetchAt
/** @type {boolean} */
this.feedHealthy
}
static getOldPodcast(libraryItemExpanded) {
@ -71,7 +75,9 @@ class Podcast extends Model {
itunesArtistId: podcastExpanded.itunesArtistId,
explicit: podcastExpanded.explicit,
language: podcastExpanded.language,
type: podcastExpanded.podcastType
type: podcastExpanded.podcastType,
lastSuccessfulFetchAt: podcastExpanded.lastSuccessfulFetchAt?.valueOf() || null,
feedHealthy: !!podcastExpanded.feedHealthy
},
coverPath: podcastExpanded.coverPath,
tags: podcastExpanded.tags,
@ -108,7 +114,9 @@ class Podcast extends Model {
maxNewEpisodesToDownload: oldPodcast.maxNewEpisodesToDownload,
coverPath: oldPodcast.coverPath,
tags: oldPodcast.tags,
genres: oldPodcastMetadata.genres
genres: oldPodcastMetadata.genres,
lastSuccessfulFetchAt: oldPodcastMetadata.lastSuccessfulFetchAt,
feedHealthy: !!oldPodcastMetadata.feedHealthy
}
}
@ -144,7 +152,9 @@ class Podcast extends Model {
maxNewEpisodesToDownload: DataTypes.INTEGER,
coverPath: DataTypes.STRING,
tags: DataTypes.JSON,
genres: DataTypes.JSON
genres: DataTypes.JSON,
lastSuccessfulFetchAt: DataTypes.DATE,
feedHealthy: DataTypes.BOOLEAN
}, {
sequelize,
modelName: 'podcast'
@ -152,4 +162,4 @@ class Podcast extends Model {
}
}
module.exports = Podcast
module.exports = Podcast