Skip to content

Commit a7e6641

Browse files
add r4 download ITs and do other fixes
1 parent 477f53f commit a7e6641

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1456
-154
lines changed

grep

Lines changed: 1127 additions & 0 deletions
Large diffs are not rendered by default.

sandbox/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM node:18.3.0-alpine3.14
22

3-
ENV npm_config_cache /home/node/app/.npm
3+
ENV npm_config_cache=/home/node/app/.npm
44

55
WORKDIR /app
66

sandbox/src/mocks/r4/requestUrlForFileDownload/example_attachment.pdf renamed to sandbox/src/mocks/r4/retrieveAttachment/example_attachment.pdf

File renamed without changes.

sandbox/src/routes/index.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,13 @@ const retrieveOboUsers = require('./r4/retrieveOboUsers')
4242
const retrieveHealthcareService = require('./r4/retrieveHealthcareService')
4343
const searchForHealthcareServices = require('./r4/searchForHealthcareServices')
4444
const searchServiceRequest = require('./r4/searchServiceRequest')
45-
const retrieveBinary = require('./r4/retrieveBinary')
46-
const retrieveBinaryHelper = require('./r4/retrieveBinaryHelper')
45+
const retrieveAttachmentR4 = require('./r4/retrieveAttachment')
46+
47+
/**
48+
* Services
49+
*/
50+
const objectStore = require('../services/objectStore')
51+
4752

4853
const routes = [].concat(
4954
getStatus,
@@ -83,8 +88,8 @@ const routes = [].concat(
8388
retrieveAdviceAndGuidanceOverviewPdf,
8489
searchServiceRequest,
8590
createAdviceAndGuidance,
86-
retrieveBinary,
87-
retrieveBinaryHelper
91+
retrieveAttachmentR4,
92+
objectStore
8893
)
8994

9095
module.exports = routes

sandbox/src/routes/r4/retrieveBinary.js renamed to sandbox/src/routes/r4/retrieveAttachment.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,34 @@ const businessFunctionValidator = require('../../services/businessFunctionValida
22

33
module.exports = [
44
/**
5-
* Sandbox implementation for retrieveBinary A042 (R4) endpoint
5+
* Sandbox implementation for Retrieve attachment A042 (R4) endpoint
66
*/
77
{
88
method: 'GET',
9-
path: '/FHIR/R4/Binary/{attachmentId}',
9+
path: '/FHIR/R4/Binary/{binaryId}',
1010
handler: (request, h) => {
1111

12-
const allowedBusinessFunctions = ["REFERRING_CLINICIAN", "REFERRING_CLINICIAN_ADMIN", "SERVICE_PROVIDER_CLINICIAN", "SERVICE_PROVIDER_CLINICIAN_ADMIN"]
12+
const allowedBusinessFunctions = ["REFERRING_CLINICIAN", "REFERRING_CLINICIAN_ADMIN", "SERVICE_PROVIDER_CLINICIAN", "SERVICE_PROVIDER_CLINICIAN_ADMIN"];
1313

14-
const validationResult = businessFunctionValidator.validateBusinessFunction(request, h, allowedBusinessFunctions)
14+
const validationResult = businessFunctionValidator.validateBusinessFunction(request, h, allowedBusinessFunctions);
1515
if (validationResult) {
16-
return validationResult
16+
return validationResult;
1717
}
1818

19-
const attachmentId = request.params.attachmentId;
19+
const binaryId = request.params.binaryId;
2020
const url = request.url.href;
21-
const objectStore = "/ObjectStore/RetrieveBinary/d497bbe3-f88b-45f1-b3d4-9c563e4c0f5f";
21+
const objectStore = "/ObjectStore/d497bbe3-f88b-45f1-b3d4-9c563e4c0f5f";
2222
const location = url.split('/FHIR')[0] + objectStore;
2323
const uuidPattern = /^[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}$/i;
2424
const attPattern = /^att-\d+-\d+$/;
2525

2626

27-
if ((uuidPattern.test(attachmentId) || attPattern.test(attachmentId)) && request.method === 'get') {
28-
const response = h.response().code(307)
27+
if ((uuidPattern.test(binaryId) || attPattern.test(binaryId)) && request.method === 'get') {
28+
const response = h.response().code(307);
2929
response.headers["Location"] = location;
30-
return response
30+
return response;
3131
} else {
32-
return h.file('./r4/R4-SandboxErrorOutcome.json').code(400);
32+
return h.file('r4/R4-SandboxErrorOutcome.json').code(400);
3333
}
3434

3535
}

sandbox/src/routes/r4/retrieveBinaryHelper.js

Lines changed: 0 additions & 22 deletions
This file was deleted.

sandbox/src/routes/r4/retrieveBusinessFunctions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = [
1616
}
1717

1818
// this should never happen as we always get a valid response for this endpoint
19-
return h.file('./r4/R4-SandboxErrorOutcome.json').code(400);
19+
return h.file('r4/R4-SandboxErrorOutcome.json').code(400);
2020

2121

2222
}

sandbox/src/routes/r4/retrieveOboUsers.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module.exports = [
1212
// check that the query exists and is correct
1313
const query = request.query._query;
1414
if (query == undefined || query != "onBehalfOf") {
15-
return h.file('./r4/R4-SandboxErrorOutcome.json').code(400);
15+
return h.file('r4/R4-SandboxErrorOutcome.json').code(400);
1616
}
1717

1818
if (request.headers["nhsd-ers-business-function"] !== "SERVICE_PROVIDER_CLINICIAN_ADMIN")
@@ -27,7 +27,7 @@ module.exports = [
2727
}
2828

2929
// this should never happen as we always get a valid response for this endpoint
30-
return h.file('./r4/R4-SandboxErrorOutcome.json').code(400);
30+
return h.file('r4/R4-SandboxErrorOutcome.json').code(400);
3131

3232

3333
}

sandbox/src/routes/stu3/acceptReferral.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module.exports = [
2323
return h.file(responsePath, { etagMethod: false }).code(200).type("application/fhir+json").etag("9", { weak: true })
2424
}
2525

26-
return h.file('STU3-SandboxErrorOutcome.json').code(422);
26+
return h.file('stu3/STU3-SandboxErrorOutcome.json').code(422);
2727
}
2828
}
2929
]

sandbox/src/routes/stu3/availableActionsForUserList.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function retrieveAvailableActionsForUserList(request, h) {
1414
return h.file(responsePath, { etagMethod: false }).code(200).type("application/fhir+json")
1515
}
1616

17-
return h.file('STU3-SandboxErrorOutcome.json').code(400);
17+
return h.file('stu3/STU3-SandboxErrorOutcome.json').code(400);
1818
}
1919

2020
module.exports = [

0 commit comments

Comments
 (0)