Skip to content

Commit

Permalink
PAF-74 Allow attachment URLs into SQS payload
Browse files Browse the repository at this point in the history
* Altered conditionals stopping 'image' array from being added to payload
* Fixed a typo
* Removed an unnecessary log
  • Loading branch information
jamiecarterHO committed Jan 11, 2024
1 parent 8300f84 commit 424f72d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/add-allegation-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ const valuesMap = require('./ims-hof-values-map.json');
const eform = {
EformFields: [],
AdditionalPeople: [],
Attachements: []
Attachments: []
};

const addFieldToEform = (fieldName, fieldValue) => {
if (fieldName === 'images') {
eform.Attachements.push({url: fieldValue});
eform.Attachments = fieldValue;
} else if (fieldName === 'txpermoreallholder') {
eform.AdditionalPeople.push({FieldName: fieldName, FieldValue: fieldValue});
} else {
Expand All @@ -31,7 +31,6 @@ const addField = (name, value) => {
}
}
if (name === 'images') {
console.log('Value :: ', value);
addFieldToEform(name, value);
}
};
Expand All @@ -43,7 +42,7 @@ const addGroup = value => {
const addAllegationData = data => {
Object.entries(data).forEach(entry => {
const [key, value] = entry;
if (value !== '' && key !== 'images') {
if (value !== '') {
if (key.includes('group')) {

This comment has been minimized.

Copy link
@TemitopeAyokuHO

TemitopeAyokuHO Jan 12, 2024

Contributor

is it possible to add the if statement in one line if(value !== '' && key.includes('group'))

This comment has been minimized.

Copy link
@jamiecarterHO

jamiecarterHO Jan 12, 2024

Author Contributor

In this case I think maybe not because the following else statement also requires value !== ''.

const groups = Array.isArray(value) ? value : value.split(',');
groups.map(addGroup);
Expand Down

0 comments on commit 424f72d

Please sign in to comment.