mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-22 03:44:28 +02:00
Start of new data model
This commit is contained in:
parent
2b7f53b0a7
commit
65793f7109
18 changed files with 672 additions and 8 deletions
38
server/objects/entities/PodcastEpisode.js
Normal file
38
server/objects/entities/PodcastEpisode.js
Normal file
|
@ -0,0 +1,38 @@
|
|||
const AudioFile = require('../files/AudioFile')
|
||||
|
||||
class PodcastEpisode {
|
||||
constructor(episode) {
|
||||
this.id = null
|
||||
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.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,
|
||||
podcastId: this.podcastId,
|
||||
episodeNumber: this.episodeNumber,
|
||||
audioFile: this.audioFile.toJSON(),
|
||||
addedAt: this.addedAt,
|
||||
updatedAt: this.updatedAt
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = PodcastEpisode
|
Loading…
Add table
Add a link
Reference in a new issue