Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion models/team.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ module.exports = function (sequelize, DataTypes) {
name: DataTypes.STRING,
description: DataTypes.STRING,
timestamps: true,
})
});
return Team;
}
6 changes: 4 additions & 2 deletions models/teamMember.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ module.exports = function (sequelize, DataTypes) {
},
timestamps: true,
})
TeamMember.belongsTo(Team, { foreignKey: 'team_id' })
TeamMember.belongsTo(User, { foreignKey: 'user_id' })
TeamMember.belongsTo(Team, { foreignKey: 'team_id' });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the build is still failing because you are using TeamMember.belongsTo in a wrong way you need to do it like this,
TeamMember.associate = (models) => { TeamMember.belongsTo(models.Team, { foreignKey: 'team_id'}) }
something like this, in your current implementation it could be possible that Team that you are importing is a empty object ... also remove the imports at the top they are not needed anymore

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for reference you can have a look at this file
here

TeamMember.belongsTo(User, { foreignKey: 'user_id' });

return TeamMember;
}