-
Notifications
You must be signed in to change notification settings - Fork 56
fix(PM-1494): Add extra info for copilot email #830
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 all commits
473b060
b63b2ad
1a8d9f2
e6f3595
f63c580
2f46d05
2201ec4
36c6e7b
cf50f64
56eb2b6
fed04b8
64091d5
eaf2116
5bf08be
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
import _ from 'lodash'; | ||
import config from 'config'; | ||
import moment from 'moment'; | ||
import { Op } from 'sequelize'; | ||
|
||
import models from '../../models'; | ||
import { CONNECT_NOTIFICATION_EVENT, COPILOT_REQUEST_STATUS, TEMPLATE_IDS, USER_ROLE } from '../../constants'; | ||
import util from '../../util'; | ||
import { createEvent } from '../../services/busApi'; | ||
import { Op } from 'sequelize'; | ||
import { getCopilotTypeLabel } from '../../utils/copilot'; | ||
|
||
const resolveTransaction = (transaction, callback) => { | ||
if (transaction) { | ||
|
@@ -16,7 +18,7 @@ const resolveTransaction = (transaction, callback) => { | |
}; | ||
|
||
module.exports = (req, data, existingTransaction) => { | ||
const { projectId, copilotRequestId } = data; | ||
const { projectId, copilotRequestId, opportunityTitle, type, startDate } = data; | ||
|
||
return resolveTransaction(existingTransaction, transaction => | ||
models.Project.findOne({ | ||
|
@@ -71,6 +73,9 @@ module.exports = (req, data, existingTransaction) => { | |
user_name: subject.handle, | ||
opportunity_details_url: `${copilotPortalUrl}/opportunity/${opportunity.id}`, | ||
work_manager_url: config.get('workManagerUrl'), | ||
opportunity_type: getCopilotTypeLabel(type), | ||
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 variable |
||
opportunity_title: opportunityTitle, | ||
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 variable |
||
start_date: moment.utc(startDate).format("YYYY-MM-DD HH:mm:ss [UTC]"), | ||
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 date format has been changed from |
||
}, | ||
sendgrid_template_id: TEMPLATE_IDS.CREATE_REQUEST, | ||
recipients: [subject.email], | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,6 +98,8 @@ module.exports = [ | |
createdBy: req.authUser.userId, | ||
updatedBy: req.authUser.userId, | ||
type: copilotRequest.data.projectType, | ||
opportunityTitle: copilotRequest.data.opportunityTitle, | ||
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. Ensure that |
||
startDate: copilotRequest.data.startDate, | ||
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. Ensure that |
||
}); | ||
return approveRequest(req, approveData, transaction).then(() => copilotRequest); | ||
}).then(copilotRequest => res.status(201).json(copilotRequest)) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { COPILOT_OPPORTUNITY_TYPE } from "../constants"; | ||
|
||
export const getCopilotTypeLabel = (type) => { | ||
switch (type) { | ||
case COPILOT_OPPORTUNITY_TYPE.AI: | ||
return 'AI'; | ||
case COPILOT_OPPORTUNITY_TYPE.DATA_SCIENCE: | ||
return "Data Science"; | ||
case COPILOT_OPPORTUNITY_TYPE.DESIGN: | ||
return "Design"; | ||
case COPILOT_OPPORTUNITY_TYPE.DEV: | ||
return "Development"; | ||
default: | ||
return "Quality Assurance"; | ||
} | ||
}; |
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 import statement for
Op
from 'sequelize' has been moved but not modified. Consider reverting the change if it was unintentional, as it does not affect functionality.