-
-
Notifications
You must be signed in to change notification settings - Fork 166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Created team schema #975
base: master
Are you sure you want to change the base?
Created team schema #975
Conversation
models/team.js
Outdated
name: DataTypes.STRING, | ||
description: DataTypes.STRING, | ||
timestamps: true, | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a return statement as well
return Team
its expected in index.js on line no 51. thats why your build is failing : |
models/teamMember.js
Outdated
timestamps: true, | ||
}) | ||
TeamMember.belongsTo(Team, { foreignKey: 'team_id' }) | ||
TeamMember.belongsTo(User, { foreignKey: 'user_id' }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a return statement as well
return TeamMember
its expected in index.js on line no 51. thats why your build is failing : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay
models/teamMember.js
Outdated
@@ -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' }); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
I think you are forgetting 1 belongs to condition here which refers to the connection with user table |
Also you still forgot to remove the import statement at the top of the file : \ |
oh sorry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we are good to go here @alexanmtz : )
Description
Changes
Issue
Impacted Area
Steps to test
Steps needed to reproduce the scenario from this change to validate if the pull request solve this issue
Before
After