Skip to content

Commit

Permalink
update getAttachmentUrl to allow download of rai attachments
Browse files Browse the repository at this point in the history
  • Loading branch information
mdial89f committed Nov 10, 2023
1 parent 69e3555 commit 5a8d824
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/services/api/handlers/getAttachmentUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,24 @@ export const handler = async (event: APIGatewayEvent) => {
});
}

const raiAttachmentList = [];
const rec = results.hits.hits[0]._source;
for (const key in rec.rais) {
const entry = rec.rais[key];
for (const attachment of entry.request.attachments) {
raiAttachmentList.push(attachment);
}
// for (const attachment of entry.response.attachments) {
// flatAttachments.push(attachment);
// }
}

const allAttachments = [
...results.hits.hits[0]._source.attachments,
...results.hits.hits[0]._source.raiResponses
.map((R) => R.attachments)
.flat(),
...raiAttachmentList,
];

if (
Expand Down

0 comments on commit 5a8d824

Please sign in to comment.