Skip to content

Commit

Permalink
Merge branch 'develop' into ft/167190444-user-comment
Browse files Browse the repository at this point in the history
  • Loading branch information
encodedBicoding committed Aug 6, 2019
2 parents 25ae4f2 + 4125a6f commit fcc927a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/db/models/article.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ module.exports = (sequelize, DataTypes) => {
slugOptions: { lower: true }
});
Article.associate = function (models) {
Article.belongsTo(models.User, { as: 'author', foreignKey: 'id', onDelete: 'CASCADE' });
Article.hasMany(models.Comment, {
Article.belongsTo(models.User, { as: 'author', foreignKey: 'authorId', onDelete: 'CASCADE' });
Article.hasMany(models.Comment, {
foreignKey: 'articleId', onDelete: 'CASCADE', as: 'comment', hooks: true
});
};
Expand Down

0 comments on commit fcc927a

Please sign in to comment.