Skip to content

feat(PM-1173): Notify all copilots on copilot opportunity #815

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 23 commits into from
Jun 10, 2025
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rebased from develop branch
  • Loading branch information
hentrymartin committed Jun 4, 2025
commit deaed3a9ff7061ebca875ffb84cb5df0b88e9e5b
2 changes: 1 addition & 1 deletion src/routes/copilotRequest/approveRequest.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ module.exports = (req, data, existingTransaction) => {
}))
Copy link

Choose a reason for hiding this comment

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

The console.log(opportunity); statement has been removed, which is good for production code, but ensure that any necessary logging is still in place for debugging purposes.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any reason to use console here instead of the req.log?

.then(async (opportunity) => {
Copy link

Choose a reason for hiding this comment

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

Consider removing the console.log(opportunity); statement if it's not needed for debugging purposes. Leaving console logs in production code can lead to performance issues and cluttered logs.

const roles = await util.getRolesByRoleName('copilot', req.log, req.id);
Copy link

Choose a reason for hiding this comment

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

The function getRolesByRoleName now takes additional parameters req.log and req.id. Ensure that req is defined and available in this context to avoid potential runtime errors.

Copy link
Contributor

Choose a reason for hiding this comment

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

Conver role name to enum/constant. Do not use hardcoded names.

const { subjects = [] } = await util.getRoleInfo(roles[0], req.log, req.id);
req.log.info("getting subjects for roles", roles[0]);
const { subjects = [] } = await util.getRoleInfo(roles[0], req.log, req.id);

Choose a reason for hiding this comment

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

The log message for getting subjects for roles has been removed. If this was intentional, ensure that the removal does not affect the debugging process. If not, consider reinstating it for better traceability.

const emailEventType = CONNECT_NOTIFICATION_EVENT.COPILOT_OPPORTUNITY_CREATED;
const copilotPortalUrl = config.get('copilotPortalUrl');
req.log.info("Sending emails to all copilots about new opportunity");
Expand Down