Commit 5cb45c8 1 parent 524cdec commit 5cb45c8 Copy full SHA for 5cb45c8
File tree 3 files changed +9
-7
lines changed
src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi
3 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestMapping
14
14
import org.springframework.web.bind.annotation.RestController
15
15
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.exception.EntityNotFoundException
16
16
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.DataResponse
17
+ import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.InductionSchedule
17
18
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.ReviewSchedule
18
19
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.UpstreamApiError
19
20
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.services.GetInductionScheduleForPersonService
@@ -39,7 +40,7 @@ class PLPController(
39
40
)
40
41
fun getInductionSchedule (
41
42
@Parameter(description = " A HMPPS id" , example = " A123123" ) @PathVariable hmppsId : String ,
42
- ): DataResponse <ReviewSchedule > {
43
+ ): DataResponse <InductionSchedule > {
43
44
val response = getInductionScheduleForPersonService.execute(hmppsId)
44
45
45
46
if (response.hasError(UpstreamApiError .Type .ENTITY_NOT_FOUND )) {
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import org.springframework.http.HttpMethod
6
6
import org.springframework.stereotype.Component
7
7
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.extensions.WebClientWrapper
8
8
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.extensions.WebClientWrapper.WebClientWrapperResponse
9
+ import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.InductionSchedule
9
10
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.Response
10
11
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.ReviewSchedule
11
12
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.UpstreamApi
@@ -19,9 +20,9 @@ class PLPGateway(
19
20
@Autowired
20
21
lateinit var hmppsAuthGateway: HmppsAuthGateway
21
22
22
- fun getInductionSchedule (prisonerNumber : String ): Response <ReviewSchedule > {
23
+ fun getInductionSchedule (prisonerNumber : String ): Response <InductionSchedule > {
23
24
val result =
24
- webClient.request<ReviewSchedule >(
25
+ webClient.request<InductionSchedule >(
25
26
HttpMethod .GET ,
26
27
" /inductions/$prisonerNumber /induction-schedule" ,
27
28
authenticationHeader(),
@@ -36,7 +37,7 @@ class PLPGateway(
36
37
37
38
is WebClientWrapperResponse .Error -> {
38
39
Response (
39
- data = ReviewSchedule (),
40
+ data = InductionSchedule (),
40
41
errors = result.errors,
41
42
)
42
43
}
Original file line number Diff line number Diff line change @@ -3,20 +3,20 @@ package uk.gov.justice.digital.hmpps.hmppsintegrationapi.services
3
3
import org.springframework.beans.factory.annotation.Autowired
4
4
import org.springframework.stereotype.Service
5
5
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.gateways.PLPGateway
6
+ import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.InductionSchedule
6
7
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.Response
7
- import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.ReviewSchedule
8
8
9
9
@Service
10
10
class GetInductionScheduleForPersonService (
11
11
@Autowired val plpGateway : PLPGateway ,
12
12
@Autowired val getPersonService : GetPersonService ,
13
13
) {
14
- fun execute (hmppsId : String ): Response <ReviewSchedule > {
14
+ fun execute (hmppsId : String ): Response <InductionSchedule > {
15
15
val response = getPersonService.getNomisNumber(hmppsId = hmppsId)
16
16
17
17
response.data?.nomisNumber?.let {
18
18
return plpGateway.getInductionSchedule(it)
19
19
}
20
- return Response (ReviewSchedule (), response.errors)
20
+ return Response (InductionSchedule (), response.errors)
21
21
}
22
22
}
You can’t perform that action at this time.
0 commit comments