Skip to content

use the v5 member API #47

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
Dec 16, 2020
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
2 changes: 1 addition & 1 deletion config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = {
AUTH0_PROXY_SERVER_URL: process.env.AUTH0_PROXY_SERVER_URL,

TERMS_API_URL: process.env.TERMS_API_URL || 'https://api.topcoder-dev.com/v5/terms',
MEMBER_API_URL: process.env.MEMBER_API_URL || 'https://api.topcoder-dev.com/v3/members',
MEMBER_API_URL: process.env.MEMBER_API_URL || 'https://api.topcoder-dev.com/v5/members',
USER_API_URL: process.env.USER_API_URL || 'https://api.topcoder-dev.com/v3/users',
CHALLENGE_API_URL: process.env.CHALLENGE_API_URL || 'http://localhost:4000/v5/challenges',
CHALLENGE_PHASES_API_URL: process.env.CHALLENGE_PHASES_API_URL || 'https://api.topcoder-dev.com/v5/challenge-phases',
Expand Down
8 changes: 4 additions & 4 deletions src/common/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,13 @@ async function getMemberIdByHandle (handle) {
async function getMemberIdByHandleFromV3Members (handle) {
let memberId
try {
logger.warn(`getMemberIdByHandle ${handle} from v3`)
logger.warn(`getMemberIdByHandle ${handle} from v5`)
const res = await getRequest(`${config.MEMBER_API_URL}/${handle}`)
if (_.get(res, 'body.result.content.userId')) {
memberId = String(res.body.result.content.userId)
if (_.get(res, 'body.userId')) {
memberId = String(res.body.userId)
}
// handle return from v3 API, handle and memberHandle are the same under case-insensitive condition
handle = _.get(res, 'body.result.content.handle')
handle = _.get(res, 'body.handle')
} catch (error) {
// re-throw all error except 404 Not-Founded, BadRequestError should be thrown if 404 occurs
if (error.status !== 404) {
Expand Down