2023-03-13 23:13:31 +01:00
|
|
|
const { DataTypes, Model } = require('sequelize')
|
|
|
|
|
|
|
|
module.exports = (sequelize) => {
|
|
|
|
class FeedEpisode extends Model { }
|
|
|
|
|
|
|
|
FeedEpisode.init({
|
|
|
|
id: {
|
|
|
|
type: DataTypes.UUID,
|
|
|
|
defaultValue: DataTypes.UUIDV4,
|
|
|
|
primaryKey: true
|
|
|
|
},
|
|
|
|
title: DataTypes.STRING,
|
|
|
|
author: DataTypes.STRING,
|
|
|
|
description: DataTypes.TEXT,
|
|
|
|
siteURL: DataTypes.STRING,
|
|
|
|
enclosureURL: DataTypes.STRING,
|
|
|
|
enclosureType: DataTypes.STRING,
|
|
|
|
enclosureSize: DataTypes.BIGINT,
|
|
|
|
pubDate: DataTypes.STRING,
|
|
|
|
season: DataTypes.STRING,
|
|
|
|
episode: DataTypes.STRING,
|
|
|
|
episodeType: DataTypes.STRING,
|
2023-03-18 22:56:57 +01:00
|
|
|
duration: DataTypes.FLOAT,
|
2023-03-13 23:13:31 +01:00
|
|
|
filePath: DataTypes.STRING,
|
|
|
|
explicit: DataTypes.BOOLEAN
|
|
|
|
}, {
|
|
|
|
sequelize,
|
2023-03-19 21:19:22 +01:00
|
|
|
modelName: 'feedEpisode'
|
2023-03-13 23:13:31 +01:00
|
|
|
})
|
|
|
|
|
2023-03-19 21:19:22 +01:00
|
|
|
const { feed } = sequelize.models
|
2023-03-13 23:13:31 +01:00
|
|
|
|
2023-03-19 21:19:22 +01:00
|
|
|
feed.hasMany(FeedEpisode)
|
|
|
|
FeedEpisode.belongsTo(feed)
|
2023-03-13 23:13:31 +01:00
|
|
|
|
|
|
|
return FeedEpisode
|
|
|
|
}
|