Skip to content

Commit a04f900

Browse files
committed
Fixing the v4 register call
1 parent b291315 commit a04f900

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/services/ProcessorService.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,20 +69,22 @@ async function _updateChallengeResource (message, isDelete) {
6969
}
7070
resourceRole = resourceRoleResponse.body[0]
7171
logger.debug(`Resource Role Response ${JSON.stringify(resourceRole)}`)
72-
const body = {
73-
roleId: resourceRole.legacyId,
74-
resourceUserId: _.get(message, 'payload.memberId'),
75-
isStudio: isStudio(v5Challenge.type)
76-
}
72+
const body = {}
73+
const userId = _.get(message, 'payload.memberId')
74+
// const body = {
75+
// roleId: resourceRole.legacyId,
76+
// resourceUserId: _.get(message, 'payload.memberId'),
77+
// isStudio: isStudio(v5Challenge.type)
78+
// }
7779

7880
// create or delete the challenge resource from V4 API
7981
let response = null
8082
if (isDelete) {
81-
logger.debug(`Deleteing Challenge Resource ${config.CHALLENGE_API_V4_URL}/${_.get(v5Challenge, 'legacyId')}/resources - ${JSON.stringify(body)}`)
82-
response = await helper.deleteRequest(`${config.CHALLENGE_API_V4_URL}/${_.get(v5Challenge, 'legacyId')}/resources`, body, m2mToken)
83+
logger.debug(`Deleteing Challenge Resource ${config.CHALLENGE_API_V4_URL}/${_.get(v5Challenge, 'legacyId')}/register?userId=${userId} - ${JSON.stringify(body)}`)
84+
response = await helper.deleteRequest(`${config.CHALLENGE_API_V4_URL}/${_.get(v5Challenge, 'legacyId')}/register?userId=${userId}`, body, m2mToken)
8385
} else {
84-
logger.debug(`POSTING Challenge Resource ${config.CHALLENGE_API_V4_URL}/${_.get(v5Challenge, 'legacyId')}/resources - ${JSON.stringify(body)}`)
85-
response = await helper.postRequest(`${config.CHALLENGE_API_V4_URL}/${_.get(v5Challenge, 'legacyId')}/resources`, body, m2mToken)
86+
logger.debug(`POSTING Challenge Resource ${config.CHALLENGE_API_V4_URL}/${_.get(v5Challenge, 'legacyId')}/unregister?userId=${userId} - ${JSON.stringify(body)}`)
87+
response = await helper.postRequest(`${config.CHALLENGE_API_V4_URL}/${_.get(v5Challenge, 'legacyId')}/unregister?userId=${userId}`, body, m2mToken)
8688
}
8789
logger.debug(`Update Challenge Response ${JSON.stringify(response)}`)
8890
}

0 commit comments

Comments
 (0)