Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit c47a92b

Browse files
Fix issue where user creation would fail
1 parent 48eb50f commit c47a92b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/services/ProcessorService.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const helper = require('../common/helper')
1313
* @param {Object} param0 The user details
1414
*/
1515
async function createUserInUbahn ({ handle, firstName, lastName }) {
16+
logger.debug(`Creating user with handle ${handle} in Ubahn`)
1617
const user = await helper.createUbahnRecord('/users', {
1718
handle,
1819
firstName,
@@ -28,6 +29,7 @@ async function createUserInUbahn ({ handle, firstName, lastName }) {
2829
*/
2930
async function createUserInTopcoder (user) {
3031
const { handle, firstName, lastName, email, countryName, providerType, provider, userId } = user
32+
logger.debug(`Creating user with handle ${handle} in Topcoder`)
3133

3234
const topcoderUser = {
3335
handle,
@@ -65,14 +67,14 @@ async function createUser (user) {
6567
// Create the user in Topcoder too
6668
const topcoderUserId = await createUserInTopcoder(user)
6769

68-
// Get the topcoder organization id
69-
const topcoderOrgId = await helper.getUbahnSingleRecord('/organizations', {
70+
// Get the topcoder organization
71+
const topcoderOrg = await helper.getUbahnSingleRecord('/organizations', {
7072
name: config.TOPCODER_ORGANIZATION_NAME
7173
})
7274

7375
// Now, proceed to map the topcoder user id with the ubahn user id
7476
await helper.createUbahnRecord(`/users/${ubahnUserId}/externalProfiles`, {
75-
organizationId: topcoderOrgId,
77+
organizationId: topcoderOrg.id,
7678
externalId: topcoderUserId
7779
})
7880

0 commit comments

Comments
 (0)