diff options
Diffstat (limited to 'lib/models/author.js')
-rw-r--r-- | lib/models/author.js | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/lib/models/author.js b/lib/models/author.js index 03f832a4..e65791cb 100644 --- a/lib/models/author.js +++ b/lib/models/author.js @@ -18,25 +18,25 @@ module.exports = function (sequelize, DataTypes) { unique: true, fields: ['noteId', 'userId'] } - ], - classMethods: { - associate: function (models) { - Author.belongsTo(models.Note, { - foreignKey: 'noteId', - as: 'note', - constraints: false, - onDelete: 'CASCADE', - hooks: true - }) - Author.belongsTo(models.User, { - foreignKey: 'userId', - as: 'user', - constraints: false, - onDelete: 'CASCADE', - hooks: true - }) - } - } + ] }) + + Author.associate = function (models) { + Author.belongsTo(models.Note, { + foreignKey: 'noteId', + as: 'note', + constraints: false, + onDelete: 'CASCADE', + hooks: true + }) + Author.belongsTo(models.User, { + foreignKey: 'userId', + as: 'user', + constraints: false, + onDelete: 'CASCADE', + hooks: true + }) + } + return Author } |