-
Notifications
You must be signed in to change notification settings - Fork 56
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
Changes from 1 commit
79fdf6f
4b8c9f7
0c54ecf
223b7bd
82dd797
9793dcc
5b29f65
a29f1c9
deaed3a
d4ed7a9
91f23ab
fb9b8a9
31a2b66
ae5952d
c16d06e
190c04c
4c98fe7
0ad22c3
cc5a28d
b52b16e
5fbd197
49356d6
e34f785
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ const resolveTransaction = (transaction, callback) => { | |
return models.sequelize.transaction(callback); | ||
}; | ||
|
||
module.exports = (data, existingTransaction) => { | ||
module.exports = (req, data, existingTransaction) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The function signature has been changed to include |
||
const { projectId, copilotRequestId } = data; | ||
|
||
return resolveTransaction(existingTransaction, transaction => | ||
|
@@ -55,8 +55,8 @@ module.exports = (data, existingTransaction) => { | |
})) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider removing the |
||
console.log(opportunity); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Avoid using |
||
const roles = await util.getRolesByRoleName('copilot'); | ||
const roleInfo = await util.getRoleInfo(roles[0]); | ||
const roles = await util.getRolesByRoleName('copilot', req.log, req.id); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The function There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Conver role name to enum/constant. Do not use hardcoded names. |
||
const roleInfo = await util.getRoleInfo(roles[0], req.log, req.id); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similarly, the function |
||
console.log(roles, roleInfo, 'roles by copilot'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider removing the |
||
|
||
return opportunity; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,7 +98,7 @@ module.exports = [ | |
updatedBy: req.authUser.userId, | ||
type: copilotRequest.data.projectType, | ||
}); | ||
return approveRequest(approveData, transaction).then(() => copilotRequest); | ||
return approveRequest(req, approveData, transaction).then(() => copilotRequest); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
}).then(copilotRequest => res.status(201).json(copilotRequest)) | ||
.catch((err) => { | ||
try { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
approveRequest
function signature has changed to includereq
as a parameter. Ensure that theapproveRequest
function is updated to handle this new parameter correctly. Ifreq
is not needed in the function, consider removing it to maintain the original function signature.