mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-03-04 15:09:44 +00:00
Update model casing & associations
This commit is contained in:
parent
2131a65299
commit
54ca58e610
45 changed files with 830 additions and 561 deletions
|
|
@ -15,12 +15,12 @@ module.exports = (sequelize) => {
|
|||
description: DataTypes.TEXT
|
||||
}, {
|
||||
sequelize,
|
||||
modelName: 'Person'
|
||||
modelName: 'person'
|
||||
})
|
||||
|
||||
const { FileMetadata } = sequelize.models
|
||||
FileMetadata.hasMany(Person, { foreignKey: 'ImageFileId' })
|
||||
Person.belongsTo(FileMetadata, { as: 'ImageFile', foreignKey: 'ImageFileId' }) // Ref: https://sequelize.org/docs/v6/core-concepts/assocs/#defining-an-alias
|
||||
const { fileMetadata } = sequelize.models
|
||||
fileMetadata.hasMany(Person, { foreignKey: 'imageFileId' })
|
||||
Person.belongsTo(fileMetadata, { as: 'imageFile', foreignKey: 'imageFileId' }) // Ref: https://sequelize.org/docs/v6/core-concepts/assocs/#defining-an-alias
|
||||
|
||||
return Person
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue