Skip to content

Commit

Permalink
SDIT-1812 Update to latest NOMIS API (#660)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikehalmamoj committed Jun 19, 2024
1 parent f11865b commit 8324596
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 16 deletions.
29 changes: 20 additions & 9 deletions openapi-specs/nomis-sync-api-docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"name": "HMPPS Digital Studio",
"email": "feedback@digital.justice.gov.uk"
},
"version": "2024-06-17.8066.d4e9c71"
"version": "2024-06-19.8097.6d4e3b3"
},
"servers": [
{
Expand Down Expand Up @@ -16234,7 +16234,7 @@
"bookingId",
"latestBooking",
"physicalAttributes",
"startDate"
"startDateTime"
],
"type": "object",
"properties": {
Expand All @@ -16244,17 +16244,17 @@
"format": "int64",
"example": 1234567
},
"startDate": {
"startDateTime": {
"pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$",
"type": "string",
"description": "The start date of the booking",
"format": "date",
"example": "2020-07-17"
"example": "2021-07-05T10:35:17"
},
"endDate": {
"endDateTime": {
"pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$",
"type": "string",
"description": "The end date of the booking, or null if the booking is still active",
"format": "date",
"example": "2021-07-16"
"example": "2021-07-05T10:35:17"
},
"physicalAttributes": {
"type": "array",
Expand All @@ -16273,7 +16273,8 @@
},
"PhysicalAttributesResponse": {
"required": [
"createDateTime"
"createDateTime",
"createdBy"
],
"type": "object",
"properties": {
Expand All @@ -16295,12 +16296,22 @@
"description": "The time the physical attributes were created",
"example": "2021-07-05T10:35:17"
},
"createdBy": {
"type": "string",
"description": "The user who created the physical attributes",
"example": "AQ425D"
},
"modifiedDateTime": {
"pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$",
"type": "string",
"description": "The time the physical attributes were last changed",
"example": "2021-07-05T10:35:17"
},
"modifiedBy": {
"type": "string",
"description": "The user who modified the physical attributes",
"example": "AQ425D"
},
"auditModuleName": {
"type": "string",
"description": "The name of the module that last changed the physical attributes, indicates if this was NOMIS or the synchronisation service",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import uk.gov.justice.digital.hmpps.prisonerfromnomismigration.nomissync.model.B
import uk.gov.justice.digital.hmpps.prisonerfromnomismigration.nomissync.model.PhysicalAttributesResponse
import uk.gov.justice.digital.hmpps.prisonerfromnomismigration.nomissync.model.PrisonerPhysicalAttributesResponse
import uk.gov.justice.digital.hmpps.prisonerfromnomismigration.wiremock.NomisApiExtension.Companion.nomisApi
import java.time.LocalDate
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter

Expand All @@ -26,14 +25,16 @@ class PrisonerProfileNomisApiMockServer(private val objectMapper: ObjectMapper)
bookings = listOf(
BookingPhysicalAttributesResponse(
bookingId = 1,
startDate = LocalDate.parse("2024-02-03"),
endDate = LocalDate.parse("2024-10-21"),
startDateTime = "2024-02-03T12:34:56",
endDateTime = "2024-10-21T12:34:56",
latestBooking = true,
physicalAttributes = listOf(
PhysicalAttributesResponse(
heightCentimetres = 180,
weightKilograms = 80,
createdBy = "A_USER",
createDateTime = LocalDateTime.now().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME),
modifiedBy = "ANOTHER_USER",
modifiedDateTime = LocalDateTime.now().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME),
auditModuleName = "MODULE",
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ class PrisonerProfileNomisApiServiceTest {
with(physicalAttributesResponse) {
assertThat(offenderNo).isEqualTo("A1234AA")
assertThat(bookings)
.extracting("bookingId", "startDate", "endDate", "latestBooking")
.containsExactly(tuple(1L, LocalDate.parse("2024-02-03"), LocalDate.parse("2024-10-21"), true))
.extracting("bookingId", "startDateTime", "endDateTime", "latestBooking")
.containsExactly(tuple(1L, "2024-02-03T12:34:56", "2024-10-21T12:34:56", true))
assertThat(bookings[0].physicalAttributes)
.extracting("heightCentimetres", "weightKilograms", "auditModuleName")
.containsExactly(tuple(180, 80, "MODULE"))
.extracting("heightCentimetres", "weightKilograms", "auditModuleName", "createdBy", "modifiedBy")
.containsExactly(tuple(180, 80, "MODULE", "A_USER", "ANOTHER_USER"))
assertThat(LocalDateTime.parse(bookings[0].physicalAttributes[0].createDateTime).toLocalDate()).isEqualTo(LocalDate.now())
assertThat(LocalDateTime.parse(bookings[0].physicalAttributes[0].modifiedDateTime!!).toLocalDate()).isEqualTo(LocalDate.now())
}
Expand Down

0 comments on commit 8324596

Please sign in to comment.