audiobookshelf/server/objects/entities/PodcastEpisode.js

41 lines
920 B
JavaScript
Raw Normal View History

2022-03-09 02:31:44 +01:00
const AudioFile = require('../files/AudioFile')
class PodcastEpisode {
constructor(episode) {
this.id = null
this.index = null
2022-03-09 02:31:44 +01:00
this.podcastId = null
this.episodeNumber = null
this.audioFile = null
this.addedAt = null
this.updatedAt = null
if (episode) {
this.construct(episode)
}
}
construct(episode) {
this.id = episode.id
this.index = episode.index
2022-03-09 02:31:44 +01:00
this.podcastId = episode.podcastId
this.episodeNumber = episode.episodeNumber
this.audioFile = new AudioFile(episode.audioFile)
this.addedAt = episode.addedAt
this.updatedAt = episode.updatedAt
}
toJSON() {
return {
id: this.id,
index: this.index,
2022-03-09 02:31:44 +01:00
podcastId: this.podcastId,
episodeNumber: this.episodeNumber,
audioFile: this.audioFile.toJSON(),
addedAt: this.addedAt,
updatedAt: this.updatedAt
}
}
}
module.exports = PodcastEpisode