Fix in association
This commit is contained in:
@@ -28,7 +28,4 @@ const UserClub = sequelize.define('UserClub', {
|
||||
timestamps: true
|
||||
});
|
||||
|
||||
User.belongsToMany(Club, { through: UserClub, foreignKey: 'userId' });
|
||||
Club.belongsToMany(User, { through: UserClub, foreignKey: 'clubId' });
|
||||
|
||||
export default UserClub;
|
||||
|
||||
@@ -85,8 +85,9 @@ Season.hasMany(Match, { foreignKey: 'seasonId', as: 'matches' });
|
||||
Match.belongsTo(Location, { foreignKey: 'locationId', as: 'location' });
|
||||
Location.hasMany(Match, { foreignKey: 'locationId', as: 'matches' });
|
||||
|
||||
User.belongsTo(UserClub, { foreignKey: 'userId', as: 'clubUser' });
|
||||
UserClub.hasMany(User, { foreignKey: 'userId', as: 'userClub' });
|
||||
User.belongsToMany(Club, { through: UserClub, foreignKey: 'userId', otherKey: 'clubId' });
|
||||
Club.belongsToMany(User, { through: UserClub, foreignKey: 'clubId', otherKey: 'userId' });
|
||||
|
||||
export {
|
||||
User,
|
||||
Log,
|
||||
|
||||
Reference in New Issue
Block a user