Skip to content

Commit 596dee8

Browse files
Merge branch 'develop' of https://github.com/topcoder-platform/challenge-api into develop
2 parents 993bc49 + 86ff56a commit 596dee8

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

src/common/helper.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,8 +492,19 @@ async function createSelfServiceProject (name, description, type, token) {
492492
}
493493
const url = `${config.PROJECTS_API_URL}`
494494
const res = await axios.post(url, projectObj, { headers: { Authorization: `Bearer ${token}` } })
495-
// await logger.endSpan(span)
496-
return _.get(res, 'data.id')
495+
const projectId = _.get(res, 'data.id')
496+
const phaseUrl = `${config.PROJECTS_API_URL}/${projectId}/phases`
497+
const phaseStartDate = Date.now()
498+
const phaseEndDate = Date.now()
499+
phaseEndDate.setMonth(phaseEndDate.getMonth() + 3)
500+
const phaseObj = {
501+
name: 'project main phase',
502+
description: 'default 90-day phase generated by self-service APIs',
503+
startDate: phaseStartDate,
504+
endDate: phaseEndDate
505+
}
506+
await axios.post(phaseUrl, phaseObj, { headers: { Authorization: `Bearer ${token}` } })
507+
return projectId
497508
}
498509

499510
/**

src/services/ChallengeService.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2077,8 +2077,7 @@ sendNotifications.schema = {
20772077
* Remove unwanted properties from the challenge object
20782078
* @param {Object} challenge the challenge object
20792079
*/
2080-
async function sanitizeChallenge (challenge) {
2081-
const span = await logger.startSpan('ChallengeService.sanitizeChallenge')
2080+
function sanitizeChallenge (challenge) {
20822081
const sanitized = _.pick(challenge, [
20832082
'trackId',
20842083
'typeId',
@@ -2156,7 +2155,6 @@ async function sanitizeChallenge (challenge) {
21562155
if (challenge.attachments) {
21572156
sanitized.attachments = _.map(challenge.attachments, attachment => _.pick(attachment, ['id', 'name', 'url', 'fileSize', 'description', 'challengeId']))
21582157
}
2159-
await logger.endSpan(span)
21602158
return sanitized
21612159
}
21622160

0 commit comments

Comments
 (0)