Skip to content

Commit fae139c

Browse files
Merge pull request #495 from topcoder-platform/revert-494-feature/projectid
Revert "feat: search mm challenge by roundId"
2 parents 13041ba + 85995a5 commit fae139c

File tree

4 files changed

+1
-24
lines changed

4 files changed

+1
-24
lines changed

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ The following parameters can be set in config files or in env variables:
6464
- RESOURCES_API_URL: TC resources API base URL
6565
- GROUPS_API_URL: TC groups API base URL
6666
- PROJECTS_API_URL: TC projects API base URL
67-
- CHALLENGE_MIGRATION_APP_URL: migration app URL
6867
- TERMS_API_URL: TC Terms API Base URL
6968
- COPILOT_RESOURCE_ROLE_IDS: copilot resource role ids allowed to upload attachment
7069
- HEALTH_CHECK_TIMEOUT: health check timeout in milliseconds

config/default.js

-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ 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',
6362
// copilot resource role ids allowed to upload attachment
6463
COPILOT_RESOURCE_ROLE_IDS: process.env.COPILOT_RESOURCE_ROLE_IDS
6564
? process.env.COPILOT_RESOURCE_ROLE_IDS.split(',') : ['10ba038e-48da-487b-96e8-8d3b99b6d18b'],

src/common/helper.js

-11
Original file line numberDiff line numberDiff line change
@@ -463,16 +463,6 @@ async function createSelfServiceProject (name, description, type, token) {
463463
return _.get(res, 'data.id')
464464
}
465465

466-
/**
467-
* Get project id by roundId
468-
* @param {String} roundId the round id
469-
*/
470-
async function getProjectIdByRoundId (roundId) {
471-
const url = `${config.CHALLENGE_MIGRATION_APP_URL}/getChallengeProjectId/${roundId}`
472-
const res = await axios.get(url)
473-
return _.get(res, 'data.projectId')
474-
}
475-
476466
/**
477467
* Get project payment
478468
* @param {String} projectId the project id
@@ -1296,7 +1286,6 @@ module.exports = {
12961286
ensureUserCanModifyChallenge,
12971287
userHasFullAccess,
12981288
sumOfPrizes,
1299-
getProjectIdByRoundId,
13001289
getGroupById,
13011290
getChallengeSubmissions,
13021291
getMemberById,

src/controllers/ChallengeController.js

+1-11
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,7 @@ const logger = require('../common/logger')
1212
* @param {Object} res the response
1313
*/
1414
async function searchChallenges (req, res) {
15-
let result = await service.searchChallenges(req.authUser, { ...req.query, ...req.body })
16-
if (!result.total && req.query.legacyId) {
17-
// maybe the legacyId is roundId for mm challenge
18-
// mm challenge use projectId as legacyId
19-
try {
20-
const legacyId = await helper.getProjectIdByRoundId(req.query.legacyId)
21-
result = await service.searchChallenges(req.authUser, { ...req.query, ...req.body, legacyId })
22-
} catch (e) {
23-
logger.debug(`Failed to get projectId with error: ${e.message}`)
24-
}
25-
}
15+
const result = await service.searchChallenges(req.authUser, { ...req.query, ...req.body })
2616
helper.setResHeaders(req, res, result)
2717
res.send(result.result)
2818
}

0 commit comments

Comments
 (0)