Skip to content

Commit c3e8fca

Browse files
committed
sanitize notes
1 parent c922d0c commit c3e8fca

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/routes/copilotOpportunityApply/create.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,14 @@ import { COPILOT_OPPORTUNITY_STATUS } from '../../constants';
99

1010
const applyCopilotRequestValidations = {
1111
body: Joi.object().keys({
12-
data: Joi.object()
13-
.keys({
14-
notes: Joi.string(),
15-
}),
12+
notes: Joi.string(),
1613
}),
1714
};
1815

1916
module.exports = [
2017
validate(applyCopilotRequestValidations),
2118
async (req, res, next) => {
22-
const data = req.body;
23-
console.log(data, 'debug data');
19+
const { notes } = req.body;
2420
const copilotOpportunityId = _.parseInt(req.params.id);
2521
if (!util.hasPermissionByReq(PERMISSION.APPLY_COPILOT_OPPORTUNITY, req)) {
2622
const err = new Error('Unable to apply for copilot opportunity');
@@ -36,8 +32,11 @@ module.exports = [
3632
createdBy: req.authUser.userId,
3733
updatedBy: req.authUser.userId,
3834
opportunityId: copilotOpportunityId,
35+
notes: notes ? req.sanitize(notes) : null,
3936
});
4037

38+
console.log(data, 'debug data data');
39+
4140
return models.CopilotOpportunity.findOne({
4241
where: {
4342
id: copilotOpportunityId,

0 commit comments

Comments
 (0)