File tree 1 file changed +11
-18
lines changed
src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/services
1 file changed +11
-18
lines changed Original file line number Diff line number Diff line change @@ -26,24 +26,17 @@ class GetPersonService(
26
26
prisonerOffenderSearchGateway.getPrisonOffender(nomsNumber = it)
27
27
}
28
28
29
- return if (prisonResponse != null ) {
30
- Response (
31
- data =
32
- mapOf (
33
- " prisonerOffenderSearch" to prisonResponse.data?.toPerson(),
34
- " probationOffenderSearch" to probationResponse.data,
35
- ),
36
- errors = prisonResponse.errors + probationResponse.errors,
29
+ val data =
30
+ mapOf (
31
+ " prisonerOffenderSearch" to prisonResponse?.data?.toPerson(),
32
+ " probationOffenderSearch" to probationResponse.data,
37
33
)
38
- } else {
39
- Response (
40
- data =
41
- mapOf (
42
- " prisonerOffenderSearch" to null ,
43
- " probationOffenderSearch" to probationResponse.data,
44
- ),
45
- errors = probationResponse.errors,
46
- )
47
- }
34
+
35
+ val errors = (prisonResponse?.errors ? : emptyList()) + probationResponse.errors
36
+
37
+ return Response (
38
+ data = data,
39
+ errors = errors,
40
+ )
48
41
}
49
42
}
You can’t perform that action at this time.
0 commit comments