From af397c1ee602564a53d956aad6b6b5a52a6e07b9 Mon Sep 17 00:00:00 2001 From: Thomas Kranitsas Date: Fri, 13 Nov 2020 12:49:08 +0200 Subject: [PATCH] use the v5 member API --- config/default.js | 2 +- src/common/helper.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/config/default.js b/config/default.js index 0ec194b..552f522 100644 --- a/config/default.js +++ b/config/default.js @@ -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', diff --git a/src/common/helper.js b/src/common/helper.js index 27e8224..8c56011 100644 --- a/src/common/helper.js +++ b/src/common/helper.js @@ -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) {