Feed and Setting models

This commit is contained in:
advplyr 2023-03-13 17:13:31 -05:00
parent bed3758268
commit c7f457da3e
10 changed files with 236 additions and 10 deletions

View file

@ -35,6 +35,12 @@ module.exports = (sequelize) => {
const { Book, PodcastEpisode, User, Device } = sequelize.models
User.hasMany(PlaybackSession)
PlaybackSession.belongsTo(User)
Device.hasMany(PlaybackSession)
PlaybackSession.belongsTo(Device)
Book.hasMany(PlaybackSession, {
foreignKey: 'mediaItemId',
constraints: false,
@ -69,11 +75,5 @@ module.exports = (sequelize) => {
}
})
User.hasMany(PlaybackSession)
PlaybackSession.belongsTo(User)
Device.hasMany(PlaybackSession)
PlaybackSession.belongsTo(Device)
return PlaybackSession
}