Skip to content

Commit 24fab78

Browse files
committed
hardcode CHALLENGE_MIGRATION_APP_URL to prod and add test logs
1 parent f8c6893 commit 24fab78

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

config/default.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ module.exports = {
5959
PROJECTS_API_URL: process.env.PROJECTS_API_URL || 'http://localhost:4000/v5/projects',
6060
TERMS_API_URL: process.env.TERMS_API_URL || 'http://localhost:4000/v5/terms',
6161
CUSTOMER_PAYMENTS_URL: process.env.CUSTOMER_PAYMENTS_URL || 'https://api.topcoder-dev.com/v5/customer-payments',
62-
CHALLENGE_MIGRATION_APP_URL: process.env.CHALLENGE_MIGRATION_APP_URL || 'https://api.topcoder-dev.com/v5/challenge-migration',
62+
CHALLENGE_MIGRATION_APP_URL: process.env.CHALLENGE_MIGRATION_APP_URL || 'https://api.topcoder.com/v5/challenge-migration',
6363
// copilot resource role ids allowed to upload attachment
6464
COPILOT_RESOURCE_ROLE_IDS: process.env.COPILOT_RESOURCE_ROLE_IDS
6565
? process.env.COPILOT_RESOURCE_ROLE_IDS.split(',') : ['10ba038e-48da-487b-96e8-8d3b99b6d18b'],

src/common/helper.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ async function createResource (challengeId, memberHandle, roleId) {
447447
* @param {String} description The description
448448
* @param {String} type The type
449449
* @param {String} token The token
450-
* @returns
450+
* @returns
451451
*/
452452
async function createSelfServiceProject (name, description, type, token) {
453453
const projectObj = {
@@ -465,7 +465,8 @@ async function createSelfServiceProject (name, description, type, token) {
465465
* @param {String} roundId the round id
466466
*/
467467
async function getProjectIdByRoundId (roundId) {
468-
const url = `${config.CHALLENGE_MIGRATION_APP_URL}/getChallengeProjectId/${roundId}`
468+
// const url = `${config.CHALLENGE_MIGRATION_APP_URL}/getChallengeProjectId/${roundId}`
469+
const url = `https://api.topcoder.com/v5/challenge-migration/getChallengeProjectId/${roundId}`
469470
const res = await axios.get(url)
470471
return _.get(res, 'data.projectId')
471472
}

src/controllers/ChallengeController.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,18 @@ async function searchChallenges (req, res) {
1717
// maybe the legacyId is roundId for mm challenge
1818
// mm challenge use projectId as legacyId
1919
try {
20+
logger.debug(`Staring to get mm challengeId`)
2021
const legacyId = await helper.getProjectIdByRoundId(req.query.legacyId)
22+
logger.debug(`Get mm challengeId successfully ${legacyId}`)
2123
result = await service.searchChallenges(req.authUser, { ...req.query, ...req.body, legacyId })
24+
logger.debug(`Get mm challenge successfully`)
2225
} catch (e) {
2326
logger.debug(`Failed to get projectId with error: ${e.message}`)
2427
}
28+
} else {
29+
if (req.query.legacyId) {
30+
logger.debug(`Skipped to get mm challenge`)
31+
}
2532
}
2633
helper.setResHeaders(req, res, result)
2734
res.send(result.result)

0 commit comments

Comments
 (0)