Skip to content

Commit

Permalink
Add extra log lines and start fetching files via URI
Browse files Browse the repository at this point in the history
  • Loading branch information
norda-gunni committed Dec 3, 2024
1 parent 467e050 commit ae7d489
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,13 @@ export const insuranceToXML = async (
const fylgiskjol: Fylgiskjol = {
fylgiskjal: [],
}
logger.info(
`arrAttachments for application ${inputObj.applicationNumber}: ${arrAttachments}`,
)
for (let i = 0; i < arrAttachments.length; i++) {
const filename = arrAttachments[i]
const fileContent = await s3Service.getFileContent(filename, 'base64')
const fileUri = attachmentNames[i] // attachmentNames actually contains the URIs
const fileContent = await s3Service.getFileContent(fileUri, 'base64')

if (!fileContent)
throw new Error(`Unable to fetch file content for: ${filename}`)
Expand Down Expand Up @@ -125,6 +129,8 @@ export const insuranceToXML = async (
vistaSkjalBody,
)}`

logger.info(`XML: ${xml}`)

return xml
}

Expand Down Expand Up @@ -222,6 +228,10 @@ export const transformApplicationToHealthInsuranceDTO = (

const attachmentNames = Object.values(application.attachments) ?? []

logger.info(
`attachmentNames for application ${application.id}: ${attachmentNames}`,
)

const vistaskjal: VistaSkjalInput = {
applicationNumber: application.id,
applicationDate: application.modified,
Expand Down

0 comments on commit ae7d489

Please sign in to comment.