Skip to content

Commit 9b3e597

Browse files
author
Parth Shah
committed
Merge branch 'release/v1.2.0'
2 parents fea2bbb + 99f06f3 commit 9b3e597

File tree

2 files changed

+26
-50
lines changed

2 files changed

+26
-50
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tc-projects-service",
3-
"version": "1.1.2",
3+
"version": "1.2.0",
44
"description": "Projects microservice",
55
"main": "index.js",
66
"engines": {

src/events/projects/index.js

Lines changed: 25 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,6 @@ import {
55
import util from '../../util'
66
import config from 'config'
77
import querystring from 'querystring'
8-
import topicService from '../../services/topicService'
9-
10-
const _addProjectStatus = (req, logger, project) => {
11-
const topics = [
12-
{
13-
title: 'Hello, Coder here! Your project has been created successfully',
14-
body: 'It took almost 245ms for me to create it, but all is good now.\
15-
That\'s a lot of hard work for a robot, you know!'
16-
}, {
17-
title: 'Hey there, I\'m ready with the next steps for your project!',
18-
body: `<p>I went over the project and I see we still need to collect more\
19-
details before I can use my super computational powers and create your quote.</p>\
20-
<p>Head over to the <a href="/projects/${project.id}/specification/">Specification</a>\
21-
section and answer all of the required questions. If you already have a document\
22-
with specification, verify it against our checklist and upload it.</p>`
23-
}
24-
]
25-
// NOTE: running these in sequence cos we want topic[0] to be created first
26-
// firing these events in parallel doesn't ensure that topic[0] is created first
27-
return topicService.createTopic(req, project.id, topics[0].title, topics[0].body)
28-
.then(() => topicService.createTopic(req, project.id, topics[1].title, topics[1].body))
29-
.then(() => {
30-
logger.debug('post-project creation messages posted')
31-
return true
32-
})
33-
}
348

359
/**
3610
* Creates a lead in salesforce for the connect project.
@@ -73,29 +47,31 @@ const _addSalesforceLead = (token, logger, project) => {
7347
* @param {[type]} channel channel to ack, nack
7448
*/
7549
const projectCreatedHandler = (logger, msg, channel) => {
76-
let project = JSON.parse(msg.content)
77-
return util.getSystemUserToken(logger)
78-
.then(token => {
79-
const req = {
80-
id: 1,
81-
log: logger,
82-
headers: {
83-
authorization: `Bearer ${token}`
84-
}
85-
}
86-
return Promise.all([
87-
_addProjectStatus(req, logger, project),
88-
_addSalesforceLead(token, logger, project).then((resp)=> logger.debug('web to lead response:', resp.status))
89-
]);
90-
})
91-
.then(() => {
92-
channel.ack(msg)
93-
})
94-
.catch(err => {
95-
// don't requeue for now
96-
logger.error('Error processing', msg, err)
97-
channel.nack(msg, false, false)
98-
})
50+
// disabling salesforce integration for now,
51+
// see https://github.com/topcoder-platform/tc-project-service/issues/38
52+
return channel.ack(msg)
53+
// let project = JSON.parse(msg.content)
54+
// return util.getSystemUserToken(logger)
55+
// .then(token => {
56+
// const req = {
57+
// id: 1,
58+
// log: logger,
59+
// headers: {
60+
// authorization: `Bearer ${token}`
61+
// }
62+
// }
63+
// return Promise.all([
64+
// _addSalesforceLead(token, logger, project).then((resp)=> logger.debug('web to lead response:', resp.status))
65+
// ]);
66+
// })
67+
// .then(() => {
68+
// channel.ack(msg)
69+
// })
70+
// .catch(err => {
71+
// // don't requeue for now
72+
// logger.error('Error processing', msg, err)
73+
// channel.nack(msg, false, false)
74+
// })
9975
}
10076

10177
module.exports = {

0 commit comments

Comments
 (0)