Skip to content

Commit

Permalink
SDIT-2337: 👽️ React to api changes in detail endpoint (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
petergphillips authored Dec 5, 2024
1 parent f7f88f0 commit 4ccaaff
Show file tree
Hide file tree
Showing 13 changed files with 206 additions and 139 deletions.
205 changes: 155 additions & 50 deletions integration_tests/mockApis/prisonerDetail.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"prisonNumber": "AB111111",
"personalDetails": {
"summary": {
"prisonNumber": "AB111111",
"pncNumber": "012345/99A",
"croNumber": "012345/99C",
Expand All @@ -18,12 +18,71 @@
"receptionDate": "1999-01-01",
"maritalStatus": "Single"
},
"addresses": [
{
"type": "Other",
"person": "FIRST LASTA",
"street": "1, Street Road",
"town": "Town A",
"county": "MERSEYSIDE",
"sequence": 8
},
{
"type": "Unknown",
"person": "",
"street": "",
"town": "Town B",
"county": "MERSEYSIDE",
"sequence": 7
},
{
"type": "Next of kin",
"person": "FIRST LASTC",
"street": "3, Street Road",
"town": "Town C",
"county": "MERSEYSIDE",
"sequence": 6
}
],
"aliases": [
{ "last": "ALIASA", "first": "OTHERA", "middle": "A", "birthDate": "19800101" },
{ "last": "ALIASB", "first": "OTHERB", "middle": "B", "birthDate": "19800102" }
{
"last": "ALIASA",
"first": "OTHERA",
"middle": "A",
"birthDate": "1980-01-01"
},
{
"last": "ALIASB",
"first": "OTHERB",
"middle": "B",
"birthDate": "1980-01-02"
}
],
"courtHearings": [
{
"date": "2001-01-12",
"court": "LISKEARD COUNTY COURT"
},
{
"date": "2001-01-04",
"court": "WELLS COUNTY COURT"
},
{
"date": "2001-01-03",
"court": "THORNBURY COUNTY COURT"
},
{
"date": "2001-01-02",
"court": "LISKEARD COUNTY COURT"
}
],
"hdcInfo": [
{ "stage": "HDC ELIGIBILITY RESULT", "status": "ELIGIBLE", "date": "2013-03-18", "reasons": "CREATED MANUALLY" },
{
"stage": "HDC ELIGIBILITY RESULT",
"status": "ELIGIBLE",
"date": "2013-03-18",
"reasons": "CREATED MANUALLY"
},
{
"stage": "HDC ELIGIBILITY",
"status": "MANUAL CHECK PASS",
Expand Down Expand Up @@ -59,70 +118,91 @@
"reason": "BREACH CONDITIONS 38A1(a)"
}
],
"addresses": [
"movements": [
{
"type": "Other",
"person": "FIRST LASTA",
"street": "1, Street Road",
"town": "Town A",
"county": "MERSEYSIDE",
"sequence": 8
"date": "1988-02-12",
"establishment": "FRANKLAND",
"type": "D",
"movement": "DISCHARGED TO COURT"
},
{ "type": "Unknown", "person": "", "street": "", "town": "Town B", "county": "MERSEYSIDE", "sequence": 7 },
{
"type": "Next of kin",
"person": "FIRST LASTC",
"street": "3, Street Road",
"town": "Town C",
"county": "MERSEYSIDE",
"sequence": 6
"date": "1987-12-21",
"establishment": "DURHAM",
"type": "R",
"movement": "UNCONVICTED REMAND"
},
{
"date": "1987-12-21",
"establishment": "BELMARSH",
"type": "D",
"movement": "DISCHARGED TO COURT"
},
{
"date": "1987-09-28",
"establishment": "BELMARSH",
"type": "R",
"movement": "UNCONVICTED REMAND"
}
],
"adjudications": [
{ "date": "1991-01-04", "outcome": "DISMISSED", "charge": "ASSAULT ON INMATE", "establishment": "FULL SUTTON" },
{ "date": "1991-01-03", "outcome": "NOT PROCEEDED WITH", "charge": "FIGHTING", "establishment": "FRANKLAND" },
"offences": [
{
"date": "2001-01-01",
"code": 101,
"establishment": "BELMARSH"
},
{
"date": "2001-01-02",
"code": 48,
"establishment": "DURHAM"
},
{
"date": "2001-01-03",
"code": 99,
"establishment": "FRANKLAND"
}
],
"offencesInCustody": [
{
"date": "1991-01-04",
"outcome": "DISMISSED",
"charge": "ASSAULT ON INMATE",
"establishment": "FULL SUTTON"
},
{
"date": "1991-01-03",
"outcome": "NOT PROCEEDED WITH",
"charge": "FIGHTING",
"establishment": "FRANKLAND"
},
{
"date": "1991-01-02",
"outcome": "NOT PROVEN",
"charge": "OFFENCE AGAINST GOAD",
"establishment": "DURHAM",
"punishments": [{ "punishment": "EXTRA WORK", "duration": 21 }]
"punishments": [
{
"punishment": "EXTRA WORK",
"duration": 21
}
]
},
{
"date": "1991-01-01",
"outcome": "PROVED",
"charge": "DISOBEYING A LAWFUL ORDER",
"establishment": "BELMARSH",
"punishments": [
{ "punishment": "CAUTION", "duration": 7 },
{ "punishment": "CONFINEMENT TO CELL OR ROOM", "duration": 7 }
{
"punishment": "CAUTION",
"duration": 7
},
{
"punishment": "CONFINEMENT TO CELL OR ROOM",
"duration": 7
}
]
}
],
"category": { "date": "2001-01-02", "category": "UNCATEGORISED (SENT MALES)" },
"courtHearings": [
{ "date": "2001-01-12", "court": "LISKEARD COUNTY COURT" },
{ "date": "2001-01-04", "court": "WELLS COUNTY COURT" },
{ "date": "2001-01-03", "court": "THORNBURY COUNTY COURT" },
{ "date": "2001-01-02", "court": "LISKEARD COUNTY COURT" }
],
"movements": [
{ "date": "1988-02-12", "type": "D", "movement": "DISCHARGED TO COURT", "establishment": "FRANKLAND" },
{ "date": "1987-12-21", "type": "R", "movement": "UNCONVICTED REMAND", "establishment": "DURHAM" },
{ "date": "1987-12-21", "type": "D", "movement": "DISCHARGED TO COURT", "establishment": "BELMARSH" },
{ "date": "1987-09-28", "type": "R", "movement": "UNCONVICTED REMAND", "establishment": "BELMARSH" }
],
"offences": [
{ "code": 101, "date": "2001-01-01", "establishment": "BELMARSH" },
{ "code": 48, "date": "2001-01-02", "establishment": "DURHAM" },
{ "code": 99, "date": "2001-01-03", "establishment": "FRANKLAND" }
],
"offencesInCustody": [
{ "date": "1991-01-04", "charge": "ASSAULT ON INMATE", "outcome": "DISMISSED", "establishment": "FULL SUTTON" },
{ "date": "1991-01-03", "charge": "FIGHTING", "outcome": "NOT PROCEEDED WITH", "establishment": "FRANKLAND" },
{ "date": "1991-01-02", "charge": "POFFENCE AGAINST GOAD", "outcome": "NOT PROVEN", "establishment": "DURHAM" },
{ "date": "1991-01-01", "charge": "DISOBEYING A LAWFUL ORDER", "outcome": "PROVED", "establishment": "BELMARSH" }
],
"sentencing": [
{
"lengthDays": 3027,
Expand All @@ -132,7 +212,13 @@
"CRD": "2004-04-04",
"HDCED": "2004-03-03"
},
{ "lengthDays": 2373, "changeDate": "2003-01-01", "SED": "2006-02-02", "LED": "2005-02-02", "CRD": "2004-03-03" },
{
"lengthDays": 2373,
"changeDate": "2003-01-01",
"SED": "2006-02-02",
"LED": "2005-02-02",
"CRD": "2004-03-03"
},
{
"lengthDays": 1278,
"changeDate": "2002-01-01",
Expand All @@ -151,5 +237,24 @@
"HDCAD": "2001-01-01",
"HDCED": "2004-01-01"
}
]
],
"sentenceSummary": {
"category": {
"date": "2001-01-02",
"category": "UNCATEGORISED (SENT MALES)"
},
"establishment": "FRANKLAND",
"courtHearing": {
"date": "2001-01-12",
"court": "LISKEARD COUNTY COURT"
},
"effectiveSentence": {
"lengthDays": 3027,
"changeDate": "2004-01-01",
"SED": "2006-01-01",
"LED": "2005-03-03",
"CRD": "2004-04-04",
"HDCED": "2004-03-03"
}
}
}
51 changes: 19 additions & 32 deletions server/@types/historical-prisoner/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,18 +118,20 @@ export interface components {
page?: components['schemas']['PageMetadata']
}
PrisonerSearchDto: {
lastName?: string
firstName?: string
middleName?: string
aliasLast?: string
aliasFirst?: string
prisonNumber: string
/** Format: date */
receptionDate?: string
isAlias: boolean
lastName?: string
firstName?: string
middleName?: string
/** Format: date */
dob?: string
isAlias: boolean
aliasLast?: string
aliasFirst?: string
aliasMiddle?: string
/** Format: date */
aliasDob?: string
}
AddressesDto: {
type?: string
Expand All @@ -140,18 +142,11 @@ export interface components {
/** Format: int32 */
sequence?: number
}
AdjudicationsDto: {
/** Format: date */
date?: string
outcome?: string
charge?: string
establishment?: string
punishments?: components['schemas']['PunishmentDto'][]
}
AliasesDto: {
last?: string
first?: string
middle?: string
/** Format: date */
birthDate?: string
}
CategoryDto: {
Expand Down Expand Up @@ -201,6 +196,7 @@ export interface components {
outcome?: string
charge?: string
establishment?: string
punishments?: components['schemas']['PunishmentDto'][]
}
PersonalDetailsDto: {
prisonNumber?: string
Expand All @@ -224,24 +220,29 @@ export interface components {
}
PrisonerDetailDto: {
prisonNumber?: string
personalDetails: components['schemas']['PersonalDetailsDto']
summary: components['schemas']['PersonalDetailsDto']
addresses?: components['schemas']['AddressesDto'][]
aliases?: components['schemas']['AliasesDto'][]
category?: components['schemas']['CategoryDto']
courtHearings?: components['schemas']['CourtHearingsDto'][]
hdcInfo?: components['schemas']['HdcInfoDto'][]
hdcRecall?: components['schemas']['HdcRecallDto'][]
movements?: components['schemas']['MovementsDto'][]
offences?: components['schemas']['OffencesDto'][]
offencesInCustody?: components['schemas']['OffencesInCustodyDto'][]
sentencing?: components['schemas']['SentencingDto'][]
adjudications?: components['schemas']['AdjudicationsDto'][]
sentenceSummary?: components['schemas']['SentenceSummaryDto']
}
PunishmentDto: {
punishment?: string
/** Format: int32 */
duration?: number
}
SentenceSummaryDto: {
category?: components['schemas']['CategoryDto']
establishment?: string
courtHearing?: components['schemas']['CourtHearingsDto']
effectiveSentence?: components['schemas']['SentencingDto']
}
SentencingDto: {
/** Format: int32 */
lengthDays?: number
Expand All @@ -261,20 +262,6 @@ export interface components {
HDCAD?: string
/** Format: date */
HDCED?: string
/** Format: date */
sed?: string
/** Format: date */
ped?: string
/** Format: date */
npd?: string
/** Format: date */
led?: string
/** Format: date */
crd?: string
/** Format: date */
hdcad?: string
/** Format: date */
hdced?: string
}
}
responses: never
Expand Down Expand Up @@ -401,7 +388,7 @@ export interface operations {
}
requestBody?: never
responses: {
/** @description prisoner detail */
/** @description Prisoner detail */
200: {
headers: {
[name: string]: unknown
Expand Down
2 changes: 1 addition & 1 deletion server/routes/detail/detailController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('Detail controller', () => {
let req: Request
let res: Response

const detail = { prisonNumber: 'AB12345', personalDetails: { firstName: 'JOHN', lastName: 'SMITH' } }
const detail = { prisonNumber: 'AB12345', summary: { firstName: 'JOHN', lastName: 'SMITH' } }

beforeEach(() => {
jest.resetAllMocks()
Expand Down
Loading

0 comments on commit 4ccaaff

Please sign in to comment.