audiobookshelf/server/models/PodcastEpisode.js

34 lines
851 B
JavaScript
Raw Normal View History

2023-03-12 20:51:45 +01:00
const { DataTypes, Model } = require('sequelize')
module.exports = (sequelize) => {
class PodcastEpisode extends Model { }
PodcastEpisode.init({
id: {
type: DataTypes.UUID,
defaultValue: DataTypes.UUIDV4,
primaryKey: true
},
index: DataTypes.INTEGER,
season: DataTypes.STRING,
episode: DataTypes.STRING,
episodeType: DataTypes.STRING,
title: DataTypes.STRING,
subtitle: DataTypes.STRING(1000),
description: DataTypes.TEXT,
pubDate: DataTypes.STRING,
enclosureURL: DataTypes.STRING,
2023-03-13 23:13:31 +01:00
enclosureSize: DataTypes.BIGINT,
2023-03-12 20:51:45 +01:00
enclosureType: DataTypes.STRING,
publishedAt: DataTypes.DATE
}, {
sequelize,
modelName: 'PodcastEpisode'
})
const { Podcast } = sequelize.models
Podcast.hasMany(PodcastEpisode)
PodcastEpisode.belongsTo(Podcast)
return PodcastEpisode
}