Skip to content

Revert "feat: search mm challenge by roundId" #495

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ The following parameters can be set in config files or in env variables:
- RESOURCES_API_URL: TC resources API base URL
- GROUPS_API_URL: TC groups API base URL
- PROJECTS_API_URL: TC projects API base URL
- CHALLENGE_MIGRATION_APP_URL: migration app URL
- TERMS_API_URL: TC Terms API Base URL
- COPILOT_RESOURCE_ROLE_IDS: copilot resource role ids allowed to upload attachment
- HEALTH_CHECK_TIMEOUT: health check timeout in milliseconds
Expand Down
1 change: 0 additions & 1 deletion config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ module.exports = {
PROJECTS_API_URL: process.env.PROJECTS_API_URL || 'http://localhost:4000/v5/projects',
TERMS_API_URL: process.env.TERMS_API_URL || 'http://localhost:4000/v5/terms',
CUSTOMER_PAYMENTS_URL: process.env.CUSTOMER_PAYMENTS_URL || 'https://api.topcoder-dev.com/v5/customer-payments',
CHALLENGE_MIGRATION_APP_URL: process.env.CHALLENGE_MIGRATION_APP_URL || 'https://api.topcoder-dev.com/v5/challenge-migration',
// copilot resource role ids allowed to upload attachment
COPILOT_RESOURCE_ROLE_IDS: process.env.COPILOT_RESOURCE_ROLE_IDS
? process.env.COPILOT_RESOURCE_ROLE_IDS.split(',') : ['10ba038e-48da-487b-96e8-8d3b99b6d18b'],
Expand Down
11 changes: 0 additions & 11 deletions src/common/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -463,16 +463,6 @@ async function createSelfServiceProject (name, description, type, token) {
return _.get(res, 'data.id')
}

/**
* Get project id by roundId
* @param {String} roundId the round id
*/
async function getProjectIdByRoundId (roundId) {
const url = `${config.CHALLENGE_MIGRATION_APP_URL}/getChallengeProjectId/${roundId}`
const res = await axios.get(url)
return _.get(res, 'data.projectId')
}

/**
* Get project payment
* @param {String} projectId the project id
Expand Down Expand Up @@ -1296,7 +1286,6 @@ module.exports = {
ensureUserCanModifyChallenge,
userHasFullAccess,
sumOfPrizes,
getProjectIdByRoundId,
getGroupById,
getChallengeSubmissions,
getMemberById,
Expand Down
12 changes: 1 addition & 11 deletions src/controllers/ChallengeController.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,7 @@ const logger = require('../common/logger')
* @param {Object} res the response
*/
async function searchChallenges (req, res) {
let result = await service.searchChallenges(req.authUser, { ...req.query, ...req.body })
if (!result.total && req.query.legacyId) {
// maybe the legacyId is roundId for mm challenge
// mm challenge use projectId as legacyId
try {
const legacyId = await helper.getProjectIdByRoundId(req.query.legacyId)
result = await service.searchChallenges(req.authUser, { ...req.query, ...req.body, legacyId })
} catch (e) {
logger.debug(`Failed to get projectId with error: ${e.message}`)
}
}
const result = await service.searchChallenges(req.authUser, { ...req.query, ...req.body })
helper.setResHeaders(req, res, result)
res.send(result.result)
}
Expand Down