Skip to content

Commit

Permalink
fix: review comments addressed
Browse files Browse the repository at this point in the history
  • Loading branch information
shrouti1507 committed Jan 4, 2024
1 parent 63d3f3b commit aef9c92
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/v0/destinations/gainsight_px/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const identifyResponseBuilder = async (message, { Config }) => {
'Content-Type': JSON_MIME_TYPE,
};

const { success: isPresent } = await objectExists(userId, Config, 'user');
const { success: isUserPresent } = await objectExists(userId, Config, 'user');

let payload = constructPayload(message, identifyMapping);
const name = getValueFromMessage(message, ['traits.name', 'context.traits.name']);
Expand All @@ -61,12 +61,12 @@ const identifyResponseBuilder = async (message, { Config }) => {
payload.lastName = lName;
}
// Only for the case of new user creation, if signUpDate is not provided in traits, timestamp / originalTimestamp is mapped
if (!isPresent && !payload.signUpDate) {
if (!isUserPresent && !payload.signUpDate) {
payload.signUpDate = formatTimeStamp(message.timestamp || message.originalTimestamp);
}

// Only for the case of new user creation, if createDate is not provided in traits, timestamp / originalTimestamp is mapped
if (!isPresent && !payload.createDate) {
if (!isUserPresent && !payload.createDate) {
payload.createDate = formatTimeStamp(message.timestamp || message.originalTimestamp);
}

Expand All @@ -89,7 +89,7 @@ const identifyResponseBuilder = async (message, { Config }) => {
type: 'USER',
};

if (isPresent) {
if (isUserPresent) {
// update user
response.method = defaultPutRequestConfig.requestMethod;
response.endpoint = `${ENDPOINTS.USERS_ENDPOINT}/${userId}`;
Expand Down

0 comments on commit aef9c92

Please sign in to comment.