diff --git a/backend/models/index.js b/backend/models/index.js index 3d5c610..e4363d0 100644 --- a/backend/models/index.js +++ b/backend/models/index.js @@ -85,6 +85,8 @@ 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: 'userClub', as: 'clubUser' }); +UserClub.hasMany(User, { foreignKey: 'userClub', as: 'userClub' }); export { User, Log, diff --git a/backend/services/clubService.js b/backend/services/clubService.js index ca1ff46..a6ff645 100644 --- a/backend/services/clubService.js +++ b/backend/services/clubService.js @@ -104,6 +104,7 @@ class ClubService { include: [ { model: User, + as: 'clubUser', attributes: ['id', 'firstName', 'lastName', 'email'] } ]