Skip to content
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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

Daniel-olaO
Copy link

Description

Description of the pull request

Changes

  • Where your changes apply

Issue

Closes #971

Impacted Area

Main page

Steps to test

Steps needed to reproduce the scenario from this change to validate if the pull request solve this issue

  • Create / log user
  • Create Task
  • Other steps

Before

Screenshot from the state before

After

Screenshot from the state after your Pull Request

models/team.js Outdated
name: DataTypes.STRING,
description: DataTypes.STRING,
timestamps: true,
})
Copy link
Contributor

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 : |

timestamps: true,
})
TeamMember.belongsTo(Team, { foreignKey: 'team_id' })
TeamMember.belongsTo(User, { foreignKey: 'user_id' })
Copy link
Contributor

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 : |

Copy link
Author

Choose a reason for hiding this comment

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

okay

@@ -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

@rogdevil
Copy link
Contributor

rogdevil commented Jun 6, 2023

I think you are forgetting 1 belongs to condition here which refers to the connection with user table

@rogdevil
Copy link
Contributor

rogdevil commented Jun 6, 2023

Also you still forgot to remove the import statement at the top of the file : \

@Daniel-olaO
Copy link
Author

oh sorry

Copy link
Contributor

@rogdevil rogdevil left a 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 : )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants