Skip to content

Commit

Permalink
VB-3611 Support 'exclude' location groups on timetable (#738)
Browse files Browse the repository at this point in the history
  • Loading branch information
tpmcgowan authored Mar 19, 2024
1 parent 941e167 commit a778fe3
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 53 deletions.
44 changes: 25 additions & 19 deletions server/@types/orchestration-api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export interface paths {
*/
get: operations['getVisitHistoryByReference']
}
'/visits/session-template/{sessionTemplateReference}': {
'/visits/session-template': {
/**
* Get visits for a session template reference and date
* @description Retrieve visits for session template reference and date
Expand Down Expand Up @@ -574,6 +574,19 @@ export interface components {
eventsAudit: components['schemas']['EventAuditDto'][]
visit: components['schemas']['VisitDto']
}
/** @description Timeslot for the visit */
SessionTimeSlotDto: {
/**
* Format: HH:mm
* @example 13:45
*/
startTime: string
/**
* Format: HH:mm
* @example 13:45
*/
endTime: string
}
VisitPreviewDto: {
/**
* @description Prisoner Number
Expand Down Expand Up @@ -601,6 +614,7 @@ export interface components {
* @example 10
*/
visitorCount: number
visitTimeSlot: components['schemas']['SessionTimeSlotDto']
}
PageVisitDto: {
/** Format: int32 */
Expand Down Expand Up @@ -794,6 +808,8 @@ export interface components {
* @enum {string}
*/
visitType: 'SOCIAL'
/** @description Determines behaviour of location groups. True will mean the location groups are inclusive, false means they are exclusive. */
areLocationGroupsInclusive: boolean
/**
* @description prisoner location group
* @example Wing C
Expand All @@ -816,19 +832,6 @@ export interface components {
*/
weeklyFrequency: number
}
/** @description The time slot of the generated visit session(s) */
SessionTimeSlotDto: {
/**
* Format: HH:mm
* @example 13:45
*/
startTime: string
/**
* Format: HH:mm
* @example 13:45
*/
endTime: string
}
GetDlqResult: {
/** Format: int32 */
messagesFoundCount: number
Expand Down Expand Up @@ -1433,6 +1436,11 @@ export interface operations {
getVisitsBySessionTemplate: {
parameters: {
query: {
/**
* @description Session template reference
* @example v9-d7-ed-7u
*/
sessionTemplateReference?: string
/**
* @description Get visits for session date
* @example 2023-05-31
Expand All @@ -1448,13 +1456,11 @@ export interface operations {
* @example OPEN
*/
visitRestrictions?: string
}
path: {
/**
* @description Session template reference
* @example v9-d7-ed-7u
* @description Filter results by prison id/code
* @example MDI
*/
sessionTemplateReference: string
prisonCode: string
}
}
responses: {
Expand Down
40 changes: 27 additions & 13 deletions server/@types/prison-api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1058,7 +1058,7 @@ export interface paths {
*/
get: operations['getPrisonerNumbers']
}
'/api/prison/{establishmentId}/booking/latest/paged/calculable-sentence-envelope': {
'/api/prison/{agencyId}/booking/latest/paged/calculable-sentence-envelope': {
/** Details of the active sentence envelope, a combination of the person information, the active booking and calculable sentences at a particular establishment (paged response) */
get: operations['getCalculableSentenceEnvelopeByEstablishment']
}
Expand Down Expand Up @@ -1829,7 +1829,7 @@ export interface paths {
'/api/bookings/v2': {
/**
* Prisoners Booking Summary
* @description Returns data that is available to the users caseload privileges, at least one attribute of a prisonId, bookingId or offenderNo must be specified
* @description Returns data that is available to the users caseload privileges, at least one attribute of a prisonId, bookingId or offenderNo must be specified.Requires parameter(s) prisonId/bookingIds/offenderNos to be in caseload, or VIEW_PRISONER_DATA
*/
get: operations['getPrisonerBookingsV2']
}
Expand Down Expand Up @@ -1929,8 +1929,8 @@ export interface paths {
}
'/api/agencies/{agencyId}/eventLocationsBooked': {
/**
* List of locations for agency where events (appointments, visits, activities) are being held.
* @description List of locations for agency where events (appointments, visits, activities) are being held.<p>This endpoint uses the REPLICA database.</p>
* List of location summaries for agency where events (appointments, visits, activities) are being held.
* @description List of location summaries for agency where events (appointments, visits, activities) are being held.<p>This endpoint uses the REPLICA database.</p>
*/
get: operations['getAgencyEventLocationsBooked']
}
Expand Down Expand Up @@ -4167,6 +4167,8 @@ export interface components {
expiryDate?: string
/** @description Alert comment */
comment?: string
/** @description Remove expiry date */
removeExpiryDate?: boolean
}
/** @description Attendance details. This is used to update the attendance details of an offender */
UpdateAttendance: {
Expand Down Expand Up @@ -7341,8 +7343,8 @@ export interface components {
pageSize?: number
/** Format: int32 */
pageNumber?: number
unpaged?: boolean
paged?: boolean
unpaged?: boolean
}
SortObject: {
empty?: boolean
Expand Down Expand Up @@ -10981,6 +10983,18 @@ export interface components {
/** @description The child groups of this group */
children: components['schemas']['LocationGroup'][]
}
/** @description Location Summary Details */
LocationSummary: {
/**
* Format: int64
* @description Location identifier.
*/
locationId: number
/** @description User-friendly location description. */
userDescription?: string
/** @description Location description. */
description: string
}
/** @description Agency Establishment Type */
AgencyEstablishmentType: {
/**
Expand Down Expand Up @@ -17529,7 +17543,7 @@ export interface operations {
}
path: {
/** @description The identifier of the establishment(prison) to get the active bookings for */
establishmentId: string
agencyId: string
}
}
responses: {
Expand Down Expand Up @@ -20298,10 +20312,10 @@ export interface operations {
}
}
responses: {
/** @description Invalid request. */
204: {
/** @description Ok */
200: {
content: {
'application/json': components['schemas']['ErrorResponse']
'application/json': components['schemas']['PrisonDetails'][]
}
}
/** @description Invalid request. */
Expand Down Expand Up @@ -21484,7 +21498,7 @@ export interface operations {
}
/**
* Prisoners Booking Summary
* @description Returns data that is available to the users caseload privileges, at least one attribute of a prisonId, bookingId or offenderNo must be specified
* @description Returns data that is available to the users caseload privileges, at least one attribute of a prisonId, bookingId or offenderNo must be specified.Requires parameter(s) prisonId/bookingIds/offenderNos to be in caseload, or VIEW_PRISONER_DATA
*/
getPrisonerBookingsV2: {
parameters: {
Expand Down Expand Up @@ -22070,8 +22084,8 @@ export interface operations {
}
}
/**
* List of locations for agency where events (appointments, visits, activities) are being held.
* @description List of locations for agency where events (appointments, visits, activities) are being held.<p>This endpoint uses the REPLICA database.</p>
* List of location summaries for agency where events (appointments, visits, activities) are being held.
* @description List of location summaries for agency where events (appointments, visits, activities) are being held.<p>This endpoint uses the REPLICA database.</p>
*/
getAgencyEventLocationsBooked: {
parameters: {
Expand All @@ -22089,7 +22103,7 @@ export interface operations {
/** @description OK */
200: {
content: {
'application/json': components['schemas']['Location'][]
'application/json': components['schemas']['LocationSummary'][]
}
}
/** @description Invalid request. */
Expand Down
29 changes: 17 additions & 12 deletions server/@types/prisoner-offender-search-api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -405,14 +405,14 @@ export interface components {
totalPages?: number
/** Format: int64 */
totalElements?: number
first?: boolean
last?: boolean
/** Format: int32 */
size?: number
content?: components['schemas']['Prisoner'][]
/** Format: int32 */
number?: number
sort?: components['schemas']['SortObject']
first?: boolean
last?: boolean
/** Format: int32 */
numberOfElements?: number
pageable?: components['schemas']['PageableObject']
Expand All @@ -422,12 +422,12 @@ export interface components {
/** Format: int64 */
offset?: number
sort?: components['schemas']['SortObject']
paged?: boolean
unpaged?: boolean
/** Format: int32 */
pageSize?: number
/** Format: int32 */
pageNumber?: number
paged?: boolean
unpaged?: boolean
}
Prisoner: {
/**
Expand Down Expand Up @@ -1129,14 +1129,14 @@ export interface components {
totalPages?: number
/** Format: int64 */
totalElements?: number
first?: boolean
last?: boolean
/** Format: int32 */
size?: number
content?: components['schemas']['Prisoner'][]
/** Format: int32 */
number?: number
sort?: components['schemas']['SortObject']
first?: boolean
last?: boolean
/** Format: int32 */
numberOfElements?: number
pageable?: components['schemas']['PageableObject']
Expand Down Expand Up @@ -1377,14 +1377,14 @@ export interface components {
totalPages?: number
/** Format: int64 */
totalElements?: number
first?: boolean
last?: boolean
/** Format: int32 */
size?: number
content?: components['schemas']['Prisoner'][]
/** Format: int32 */
number?: number
sort?: components['schemas']['SortObject']
first?: boolean
last?: boolean
/** Format: int32 */
numberOfElements?: number
pageable?: components['schemas']['PageableObject']
Expand Down Expand Up @@ -1490,14 +1490,14 @@ export interface components {
totalPages?: number
/** Format: int64 */
totalElements?: number
first?: boolean
last?: boolean
/** Format: int32 */
size?: number
content?: components['schemas']['Prisoner'][]
/** Format: int32 */
number?: number
sort?: components['schemas']['SortObject']
first?: boolean
last?: boolean
/** Format: int32 */
numberOfElements?: number
pageable?: components['schemas']['PageableObject']
Expand Down Expand Up @@ -1749,13 +1749,18 @@ export interface components {
*/
attribute?: string
/**
* @description The condition to apply to the attribute
* @description The condition to apply to the attribute.
*
* IS and IS_NOT require an exact match (wildcards ? and * will not work).
*
* CONTAINS checks for a partial match and respects wildcards ? (single character) and * (zero to many characters).
*
* @example IS
* @enum {string}
*/
condition?: 'IS' | 'IS_NOT' | 'CONTAINS'
/**
* @description The search term to apply to the attribute
* @description The search term to apply to the attribute. Search terms are not case-sensitive.
* @example Smith
*/
searchTerm?: string
Expand Down
12 changes: 7 additions & 5 deletions server/@types/whereabouts-api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,7 @@ export interface components {
content?: components['schemas']['AttendanceHistoryDto'][]
/** Format: int32 */
number?: number
sort?: components['schemas']['SortObject']
sort?: components['schemas']['SortObject'][]
/** Format: int32 */
numberOfElements?: number
pageable?: components['schemas']['PageableObject']
Expand All @@ -952,7 +952,7 @@ export interface components {
PageableObject: {
/** Format: int64 */
offset?: number
sort?: components['schemas']['SortObject']
sort?: components['schemas']['SortObject'][]
/** Format: int32 */
pageSize?: number
/** Format: int32 */
Expand All @@ -961,9 +961,11 @@ export interface components {
unpaged?: boolean
}
SortObject: {
empty?: boolean
sorted?: boolean
unsorted?: boolean
direction?: string
nullHandling?: string
ascending?: boolean
property?: string
ignoreCase?: boolean
}
AttendanceSummary: {
/** Format: int32 */
Expand Down
2 changes: 2 additions & 0 deletions server/routes/testutils/testData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ export default class TestData {
validToDate: undefined,
},
capacity = { closed: 0, open: 40 },
areLocationGroupsInclusive = true,
prisonerLocationGroupNames = [],
prisonerCategoryGroupNames = [],
prisonerIncentiveLevelGroupNames = [],
Expand All @@ -344,6 +345,7 @@ export default class TestData {
sessionTimeSlot,
sessionDateRange,
capacity,
areLocationGroupsInclusive,
prisonerLocationGroupNames,
prisonerCategoryGroupNames,
prisonerIncentiveLevelGroupNames,
Expand Down
12 changes: 12 additions & 0 deletions server/routes/timetable.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,12 @@ describe('View visits timetable', () => {
prisonerIncentiveLevelGroupNames: ['Super enhanced prisoners'],
}), // Row 8
TestData.sessionSchedule({ prisonerCategoryGroupNames: ['Category A (High Risk) prisoners'] }), // Row 9
TestData.sessionSchedule({ areLocationGroupsInclusive: false, prisonerLocationGroupNames: ['Group 1'] }), // Row 10
TestData.sessionSchedule({
areLocationGroupsInclusive: false,
prisonerIncentiveLevelGroupNames: ['Enhanced prisoners'],
prisonerLocationGroupNames: ['Group 1'],
}), // Row 11
]
visitSessionsService.getSessionSchedule.mockResolvedValue(sessionSchedule)

Expand Down Expand Up @@ -202,6 +208,12 @@ describe('View visits timetable', () => {
expect($('[data-test="schedule-end-date-8"]').text()).toBe('31 December 2025')
// Row 9
expect($('[data-test="schedule-attendees-9"]').text().trim()).toBe('Category A (High Risk) prisoners')
// Row 10
expect($('[data-test="schedule-attendees-10"]').text().trim()).toMatch(/All prisoners except:\s+Group 1/)
// Row 11
expect($('[data-test="schedule-attendees-11"]').text().trim()).toMatch(
/Enhanced prisoners except in:\s+Group 1/,
)
})
})
})
Loading

0 comments on commit a778fe3

Please sign in to comment.