Skip to content

Commit 79cc8b4

Browse files
committed
NRL-523 return a 200 for when no pointer is found for given ID
1 parent 95f515e commit 79cc8b4

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

api/producer/deleteDocumentReference/delete_document_reference.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ def handler(
4040

4141
if not (core_model := repository.get_by_id(pointer_id)):
4242
logger.log(LogReference.PRODELETE002, pointer_id=pointer_id)
43-
return SpineErrorResponse.NO_RECORD_FOUND(
44-
diagnostics="The requested DocumentReference could not be found",
45-
)
43+
return NRLResponse.RESOURCE_DOES_NOT_EXIST_DELETE()
4644

4745
repository.delete(core_model)
4846

api/producer/deleteDocumentReference/tests/test_delete_document_reference.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def test_delete_document_reference_not_exists(repository: DocumentPointerReposit
140140
body = result.pop("body")
141141

142142
assert result == {
143-
"statusCode": "404",
143+
"statusCode": "200",
144144
"headers": default_response_headers(),
145145
"isBase64Encoded": False,
146146
}
@@ -150,14 +150,14 @@ def test_delete_document_reference_not_exists(repository: DocumentPointerReposit
150150
"resourceType": "OperationOutcome",
151151
"issue": [
152152
{
153-
"severity": "error",
154-
"code": "not-found",
153+
"severity": "information",
154+
"code": "informational",
155155
"details": {
156156
"coding": [
157157
{
158-
"code": "NO_RECORD_FOUND",
159-
"display": "No record found",
160-
"system": "https://fhir.nhs.uk/ValueSet/Spine-ErrorOrWarningCode-1",
158+
"code": "RESOURCE_DELETED",
159+
"display": "Resource deleted",
160+
"system": "https://fhir.nhs.uk/ValueSet/NRL-ResponseCode",
161161
}
162162
]
163163
},

layer/nrlf/core/response.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,20 @@ def RESOURCE_DELETED(cls):
117117
statusCode="200",
118118
)
119119

120+
@classmethod
121+
def RESOURCE_DOES_NOT_EXIST_DELETE(cls):
122+
return cls.from_issues(
123+
issues=[
124+
producer_model.OperationOutcomeIssue(
125+
severity="information",
126+
code="informational",
127+
details=NRLResponseConcept.from_code("RESOURCE_DELETED"),
128+
diagnostics="The requested DocumentReference could not be found",
129+
)
130+
],
131+
statusCode="200",
132+
)
133+
120134

121135
class SpineErrorResponse(Response):
122136
@classmethod

0 commit comments

Comments
 (0)