Skip to content

Commit

Permalink
chore: resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
utsabc committed Jan 19, 2024
2 parents ef778c6 + 34bf49d commit c53aeba
Show file tree
Hide file tree
Showing 25 changed files with 7,970 additions and 3,701 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/prepare-for-dev-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
report-coverage:
name: Report Code Coverage
if: github.event_name == 'push'
uses: ./.github/workflows/report-code-coverage.yml
uses: ./.github/workflows/dt-test-and-report-code-coverage.yml
secrets:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prepare-for-prod-dt-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
report-coverage:
name: Report Code Coverage
if: github.event_name == 'push'
uses: ./.github/workflows/report-code-coverage.yml
uses: ./.github/workflows/dt-test-and-report-code-coverage.yml
secrets:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prepare-for-prod-ut-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
report-coverage:
name: Report Code Coverage
if: github.event_name == 'push'
uses: ./.github/workflows/report-code-coverage.yml
uses: ./.github/workflows/dt-test-and-report-code-coverage.yml
secrets:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

Expand Down
3 changes: 2 additions & 1 deletion src/cdk/v2/destinations/ortto/procWorkflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ steps:
description: |
Builds common fields in destination payload.
template: |
let phone = .message.().({{{{$.getGenericPaths("phone")}}}});
let commonFields = .message.().({
"fields": {
"str::first": {{{{$.getGenericPaths("firstName")}}}},
Expand All @@ -46,7 +47,7 @@ steps:
"dtz::b": $.getBirthdayObj({{{{$.getGenericPaths("birthday")}}}}),
"str::ei": {{{{$.getGenericPaths("userId")}}}},
"str::language": .context.traits.language || .context.locale,
"phn::phone": {"n": {{{{$.getGenericPaths("phone")}}}}},
"phn::phone": phone ? {"n": phone},
"bol::gdpr": .context.traits.gdpr ?? true,
"bol::p": .context.traits.emailConsent || false,
"bol::sp": .context.traits.smsConsent || false,
Expand Down
49 changes: 30 additions & 19 deletions src/cdk/v2/destinations/the_trade_desk/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const {
getSuccessRespEvents,
removeUndefinedAndNullValues,
handleRtTfSingleEventError,
isEmptyObject,
} = require('../../../../v0/util');
const tradeDeskConfig = require('./config');

Expand Down Expand Up @@ -59,34 +60,44 @@ const processRecordInputs = (inputs, destination) => {
const successMetadata = [];
const errorResponseList = [];

const error = new InstrumentationError('Invalid action type');
const invalidActionTypeError = new InstrumentationError('Invalid action type');
const emptyFieldsError = new InstrumentationError('Fields cannot be empty');

inputs.forEach((input) => {
const { fields, action } = input.message;
const isInsertOrDelete = action === 'insert' || action === 'delete';

if (isInsertOrDelete) {
successMetadata.push(input.metadata);
const data = [
{
Name: Config.audienceId,
TTLInMinutes: action === 'insert' ? ttlInMin(Config.ttlInDays) : 0,
},
];

Object.keys(fields).forEach((id) => {
const value = fields[id];
if (value) {
// adding only non empty ID's
items.push({ [id]: value, Data: data });
}
});
} else {
errorResponseList.push(handleRtTfSingleEventError(input, error, {}));
if (!isInsertOrDelete) {
errorResponseList.push(handleRtTfSingleEventError(input, invalidActionTypeError, {}));
return;
}

if (isEmptyObject(fields)) {
errorResponseList.push(handleRtTfSingleEventError(input, emptyFieldsError, {}));
return;
}

successMetadata.push(input.metadata);
const data = [
{
Name: Config.audienceId,
TTLInMinutes: action === 'insert' ? ttlInMin(Config.ttlInDays) : 0,
},
];

Object.keys(fields).forEach((id) => {
const value = fields[id];
if (value) {
// adding only non empty ID's
items.push({ [id]: value, Data: data });
}
});
});

const payloads = batchResponseBuilder(items, Config);
if (payloads.length === 0) {
return errorResponseList;
}

const response = getSuccessRespEvents(payloads, successMetadata, destination, true);
return [response, ...errorResponseList];
Expand Down
Loading

0 comments on commit c53aeba

Please sign in to comment.