@@ -13,6 +13,7 @@ const helper = require('../common/helper')
13
13
* @param {Object } param0 The user details
14
14
*/
15
15
async function createUserInUbahn ( { handle, firstName, lastName } ) {
16
+ logger . debug ( `Creating user with handle ${ handle } in Ubahn` )
16
17
const user = await helper . createUbahnRecord ( '/users' , {
17
18
handle,
18
19
firstName,
@@ -28,6 +29,7 @@ async function createUserInUbahn ({ handle, firstName, lastName }) {
28
29
*/
29
30
async function createUserInTopcoder ( user ) {
30
31
const { handle, firstName, lastName, email, countryName, providerType, provider, userId } = user
32
+ logger . debug ( `Creating user with handle ${ handle } in Topcoder` )
31
33
32
34
const topcoderUser = {
33
35
handle,
@@ -65,14 +67,14 @@ async function createUser (user) {
65
67
// Create the user in Topcoder too
66
68
const topcoderUserId = await createUserInTopcoder ( user )
67
69
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' , {
70
72
name : config . TOPCODER_ORGANIZATION_NAME
71
73
} )
72
74
73
75
// Now, proceed to map the topcoder user id with the ubahn user id
74
76
await helper . createUbahnRecord ( `/users/${ ubahnUserId } /externalProfiles` , {
75
- organizationId : topcoderOrgId ,
77
+ organizationId : topcoderOrg . id ,
76
78
externalId : topcoderUserId
77
79
} )
78
80
0 commit comments