Last active
December 19, 2019 16:44
-
-
Save Noerdsteil/7a5351917ef5968be1e869eced6fdefd to your computer and use it in GitHub Desktop.
Sequelize association in userEntity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
User.associate = function ({ Company, UserRole, Role }) { | |
// association for or table not needed anymore | |
// models.User.hasMany(models.Order) | |
User.belongsTo(Company, { as: 'company' }) | |
User.belongsToMany(Role, { as: 'roles') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment