Skip to content

fix(PM-1273): Send canApplyAsCopilot to check if the user can apply for the opportunity #824

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

Merged
merged 10 commits into from
Jun 19, 2025
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ workflows:
context : org-global
filters:
branches:
only: ['develop', 'migration-setup', 'pm-1356']
only: ['develop', 'migration-setup', 'pm-1273']
- deployProd:
context : org-global
filters:
Expand Down
4 changes: 4 additions & 0 deletions src/models/projectMember.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ module.exports = function defineProjectMember(sequelize, DataTypes) {
],
});

ProjectMember.associate = (models) => {
ProjectMember.belongsTo(models.Project, { foreignKey: 'projectId' });
};

Choose a reason for hiding this comment

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

Consider adding validation or error handling for the association to ensure that the projectId foreign key is valid and exists in the Project model. This can help prevent potential runtime errors if the association is used with invalid data.


ProjectMember.getProjectIdsForUser = userId => ProjectMember.findAll({
where: {
deletedAt: { $eq: null },
Expand Down
7 changes: 7 additions & 0 deletions src/routes/copilotOpportunity/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ module.exports = [
model: models.Project,
as: 'project',
attributes: ['name'],

Choose a reason for hiding this comment

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

The attributes array on line 22 originally included 'members', which has now been moved to a separate include block. Ensure that this change aligns with the intended data structure and that the 'members' attribute is correctly populated in the response.

include: [
{
model: models.ProjectMember,
as: 'members',
attributes: ['id', 'userId', 'role'],
},
]
},
],
})
Expand Down