Skip to content

Commit 86ff56a

Browse files
Merge pull request #513 from topcoder-platform/prod2656
added call to create project phase
2 parents 6d9fa1c + 002e953 commit 86ff56a

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
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
/**

0 commit comments

Comments
 (0)