Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SAA-2272: Migrate from prison api Alerts to Alerts API #1319

Merged
merged 6 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ This service requires the following dependent services:

## Alerts

- Details of relevant alerts can be obtained from the `hmpps-prodiner-profile` repository [here](https://github.com/ministryofjustice/hmpps-prisoner-profile/blob/main/server/data/alertFlags/alertFlags.ts).
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This link is a 404.
Also prisoner profile just uses the alerts API now so no information available

- The icons for badges can be obtained from the `digital-prison-services` repository [here](https://github.com/ministryofjustice/digital-prison-services/tree/main/static/images).

## Running the application
Expand Down Expand Up @@ -100,6 +99,7 @@ FRONTEND_COMPONENT_API_URL=https://frontend-components-dev.hmpps.service.justice
MANAGE_USERS_API_URL=https://manage-users-api-dev.hmpps.service.justice.gov.uk
BOOK_A_VIDEO_LINK_API_URL=https://book-a-video-link-api-dev.prison.service.justice.gov.uk
NON_ASSOCIATIONS_API_URL=https://non-associations-api-dev.hmpps.service.justice.gov.uk
ALERTS_API_URL=https://alerts-api-dev.hmpps.service.justice.gov.uk
LOCATIONS_INSIDE_PRISON_API_URL=https://locations-inside-prison-api-dev.hmpps.service.justice.gov.uk
NOMIS_MAPPING_API_URL=https://nomis-sync-prisoner-mapping-dev.hmpps.service.justice.gov.uk
VIDEO_CONFERENCE_SCHEDULE_URL=https://video-conference-schedule-dev.prison.service.justice.gov.uk
Expand Down
1 change: 1 addition & 0 deletions feature.env
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ MANAGE_USERS_API_URL=http://localhost:9091
CASE_NOTES_API_URL=http://localhost:9091
BOOK_A_VIDEO_LINK_API_URL=http://localhost:9091
NON_ASSOCIATIONS_API_URL=http://localhost:9091
ALERTS_API_URL=http://localhost:9091
LOCATIONS_INSIDE_PRISON_API_URL=http://localhost:9091
NOMIS_MAPPING_API_URL=http://localhost:9091
TOKEN_VERIFICATION_ENABLED=true
Expand Down
1 change: 1 addition & 0 deletions generate-alerts-types.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx openapi-typescript https://alerts-api-dev.hmpps.service.justice.gov.uk/v3/api-docs > server/@types/alertsApi/index.d.ts
1 change: 1 addition & 0 deletions helm_deploy/values-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ generic-service:
MANAGE_USERS_API_URL: "https://manage-users-api-dev.hmpps.service.justice.gov.uk"
BOOK_A_VIDEO_LINK_API_URL: "https://book-a-video-link-api-dev.prison.service.justice.gov.uk"
NON_ASSOCIATIONS_API_URL: "https://non-associations-api-dev.hmpps.service.justice.gov.uk"
ALERTS_API_URL: "https://alerts-api-dev.hmpps.service.justice.gov.uk"
REPORTING_API_URL: "http://hmpps-digital-prison-reporting-mi-dev.hmpps-digital-prison-reporting-mi-dev.svc.cluster.local"
LOCATIONS_INSIDE_PRISON_API_URL: "https://locations-inside-prison-api-dev.hmpps.service.justice.gov.uk"
NOMIS_MAPPING_API_URL: "https://nomis-sync-prisoner-mapping-dev.hmpps.service.justice.gov.uk"
Expand Down
1 change: 1 addition & 0 deletions helm_deploy/values-preprod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ generic-service:
MANAGE_USERS_API_URL: "https://manage-users-api-preprod.hmpps.service.justice.gov.uk"
BOOK_A_VIDEO_LINK_API_URL: "https://book-a-video-link-api-preprod.prison.service.justice.gov.uk"
NON_ASSOCIATIONS_API_URL: "https://non-associations-api-preprod.hmpps.service.justice.gov.uk"
ALERTS_API_URL: "https://alerts-api-preprod.hmpps.service.justice.gov.uk"
REPORTING_API_URL: "http://hmpps-digital-prison-reporting-mi-preprod.hmpps-digital-prison-reporting-mi-preprod.svc.cluster.local"
LOCATIONS_INSIDE_PRISON_API_URL: "https://locations-inside-prison-api-preprod.hmpps.service.justice.gov.uk"
NOMIS_MAPPING_API_URL: "https://nomis-sync-prisoner-mapping-preprod.hmpps.service.justice.gov.uk"
Expand Down
1 change: 1 addition & 0 deletions helm_deploy/values-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ generic-service:
MANAGE_USERS_API_URL: "https://manage-users-api.hmpps.service.justice.gov.uk"
BOOK_A_VIDEO_LINK_API_URL: "https://book-a-video-link-api.prison.service.justice.gov.uk"
NON_ASSOCIATIONS_API_URL: "https://non-associations-api.hmpps.service.justice.gov.uk"
ALERTS_API_URL: "https://alerts-api.hmpps.service.justice.gov.uk"
REPORTING_API_URL: "http://hmpps-digital-prison-reporting-mi-prod.hmpps-digital-prison-reporting-mi-prod.svc.cluster.local"
LOCATIONS_INSIDE_PRISON_API_URL: "https://locations-inside-prison-api.hmpps.service.justice.gov.uk"
NOMIS_MAPPING_API_URL: "https://nomis-sync-prisoner-mapping.hmpps.service.justice.gov.uk"
Expand Down
4 changes: 2 additions & 2 deletions integration_tests/e2e/appointments/createAppointment.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import getScheduledEvents from '../../fixtures/activitiesApi/getScheduledEventsM
import getAppointmentSeries from '../../fixtures/activitiesApi/getAppointmentSeries.json'
import getGroupAppointmentSeriesDetails from '../../fixtures/activitiesApi/getGroupAppointmentSeriesDetails.json'
import getGroupAppointmentDetails from '../../fixtures/activitiesApi/getGroupAppointmentDetails.json'
import getOffenderAlerts from '../../fixtures/activitiesApi/getOffenderAlerts.json'
import getPrisonerAlerts from '../../fixtures/alertsApi/getPrisonerAlerts.json'
import getNonAssociationsBetweenA8644DYA1350DZ from '../../fixtures/nonAssociationsApi/getNonAssociationsBetweenA8644DYA1350DZ.json'
import HowToAddPrisonersPage from '../../pages/appointments/create-and-edit/howToAddPrisonersPage'
import ReviewPrisonersPage from '../../pages/appointments/create-and-edit/reviewPrisonersPage'
Expand Down Expand Up @@ -80,7 +80,7 @@ context('Create group appointment', () => {
'/users/jsmith',
JSON.parse('{"name": "John Smith", "username": "jsmith", "authSource": "nomis"}'),
)
cy.stubEndpoint('POST', '/api/bookings/offenderNo/MDI/alerts', getOffenderAlerts)
cy.stubEndpoint('POST', '/search/alerts/prison-numbers\\?includeInactive=false', getPrisonerAlerts)
cy.stubEndpoint('POST', '/non-associations/between', getNonAssociationsBetweenA8644DYA1350DZ)
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import TierPage from '../../pages/appointments/create-and-edit/tierPage'
import HostPage from '../../pages/appointments/create-and-edit/hostPage'
import HowToAddPrisonersPage from '../../pages/appointments/create-and-edit/howToAddPrisonersPage'
import ReviewPrisonersPage from '../../pages/appointments/create-and-edit/reviewPrisonersPage'
import getOffenderAlerts from '../../fixtures/activitiesApi/getOffenderAlertsA8644DY.json'
import getPrisonerAlertsA8644DY from '../../fixtures/alertsApi/getPrisonerAlertsA8644DY.json'
import ReviewPrisonerAlertsPage from '../../pages/appointments/create-and-edit/reviewPrisonerAlertsPage'

context('Create group appointment - back links', () => {
Expand All @@ -52,7 +52,7 @@ context('Create group appointment - back links', () => {
cy.stubEndpoint('POST', '/appointment-series', getAppointmentSeries)
cy.stubEndpoint('GET', '/appointment-series/10/details', getAppointmentSeriesDetails)
cy.stubEndpoint('GET', '/appointments/11/details', getAppointmentDetails)
cy.stubEndpoint('POST', '/api/bookings/offenderNo/MDI/alerts', getOffenderAlerts)
cy.stubEndpoint('POST', '/search/alerts/prison-numbers\\?includeInactive=false', getPrisonerAlertsA8644DY)
cy.stubEndpoint('POST', '/non-associations/between', [])
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import TierPage from '../../pages/appointments/create-and-edit/tierPage'
import HostPage from '../../pages/appointments/create-and-edit/hostPage'
import HowToAddPrisonersPage from '../../pages/appointments/create-and-edit/howToAddPrisonersPage'
import ReviewPrisonersPage from '../../pages/appointments/create-and-edit/reviewPrisonersPage'
import getOffenderAlerts from '../../fixtures/activitiesApi/getOffenderAlertsA8644DY.json'
import getPrisonerAlertsA8644DY from '../../fixtures/alertsApi/getPrisonerAlertsA8644DY.json'
import ReviewPrisonerAlertsPage from '../../pages/appointments/create-and-edit/reviewPrisonerAlertsPage'

context('Create group appointment - check answers change links', () => {
Expand Down Expand Up @@ -66,7 +66,7 @@ context('Create group appointment - check answers change links', () => {
cy.stubEndpoint('POST', '/appointment-series', getAppointmentSeries)
cy.stubEndpoint('GET', '/appointment-series/10/details', getAppointmentSeriesDetails)
cy.stubEndpoint('GET', '/appointments/11/details', getAppointmentDetails)
cy.stubEndpoint('POST', '/api/bookings/offenderNo/MDI/alerts?', getOffenderAlerts)
cy.stubEndpoint('POST', '/search/alerts/prison-numbers\\?includeInactive=false', getPrisonerAlertsA8644DY)
cy.stubEndpoint('POST', '/non-associations/between', [])
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import getPrisonerA8644DY from '../../fixtures/prisonerSearchApi/getPrisoner-MDI
import getAppointmentSeriesDetails from '../../fixtures/activitiesApi/getAppointmentSeriesDetails.json'
import getAppointmentDetails from '../../fixtures/activitiesApi/getAppointmentDetails.json'
import ReviewPrisonerAlertsPage from '../../pages/appointments/create-and-edit/reviewPrisonerAlertsPage'
import getOffenderAlerts from '../../fixtures/activitiesApi/getOffenderAlertsA8644DY.json'
import getPrisonerAlerts from '../../fixtures/alertsApi/getPrisonerAlertsA8644DY.json'

context('Create group appointment', () => {
const tomorrow = addDays(new Date(), 1)
Expand Down Expand Up @@ -58,7 +58,7 @@ context('Create group appointment', () => {
'/users/jsmith',
JSON.parse('{"name": "John Smith", "username": "jsmith", "authSource": "nomis"}'),
)
cy.stubEndpoint('POST', '/api/bookings/offenderNo/MDI/alerts', getOffenderAlerts)
cy.stubEndpoint('POST', '/search/alerts/prison-numbers\\?includeInactive=false', getPrisonerAlerts)
cy.stubEndpoint('POST', '/non-associations/between', [])
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import ExtraInformationPage from '../../pages/appointments/create-and-edit/extra
import SchedulePage from '../../pages/appointments/create-and-edit/schedulePage'
import TierPage from '../../pages/appointments/create-and-edit/tierPage'
import HostPage from '../../pages/appointments/create-and-edit/hostPage'
import getOffenderAlerts from '../../fixtures/activitiesApi/getOffenderAlerts.json'
import getPrisonerAlerts from '../../fixtures/alertsApi/getPrisonerAlerts.json'
import ReviewPrisonerAlertsPage, {
arsonistBadge,
catABadge,
Expand Down Expand Up @@ -86,7 +86,7 @@ context('Create group appointment', () => {
'/users/jsmith',
JSON.parse('{"name": "John Smith", "username": "jsmith", "authSource": "nomis"}'),
)
cy.stubEndpoint('POST', '/api/bookings/offenderNo/MDI/alerts?', getOffenderAlerts)
cy.stubEndpoint('POST', '/search/alerts/prison-numbers\\?includeInactive=false', getPrisonerAlerts)
cy.stubEndpoint('POST', '/non-associations/between', [])
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import getScheduledEvents from '../../fixtures/activitiesApi/getScheduledEventsM
import getAppointmentSeries from '../../fixtures/activitiesApi/getAppointmentSeries.json'
import getGroupAppointmentSeriesDetails from '../../fixtures/activitiesApi/getGroupAppointmentSeriesDetails.json'
import getGroupAppointmentDetails from '../../fixtures/activitiesApi/getGroupAppointmentDetails.json'
import getOffenderAlerts from '../../fixtures/activitiesApi/getOffenderAlerts.json'
import getPrisonerAlerts from '../../fixtures/alertsApi/getPrisonerAlerts.json'
import HowToAddPrisonersPage from '../../pages/appointments/create-and-edit/howToAddPrisonersPage'
import ReviewPrisonersPage from '../../pages/appointments/create-and-edit/reviewPrisonersPage'
import ReviewPrisonerAlertsPage, {
Expand Down Expand Up @@ -73,7 +73,7 @@ context('Create a retrospective appointment', () => {
'/users/jsmith',
JSON.parse('{"name": "John Smith", "username": "jsmith", "authSource": "nomis"}'),
)
cy.stubEndpoint('POST', '/api/bookings/offenderNo/MDI/alerts', getOffenderAlerts)
cy.stubEndpoint('POST', '/search/alerts/prison-numbers\\?includeInactive=false', getPrisonerAlerts)
cy.stubEndpoint('POST', '/non-associations/between', [])
})

Expand Down
4 changes: 2 additions & 2 deletions integration_tests/e2e/appointments/duplicateAppointment.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import ReviewPrisonersPage from '../../pages/appointments/create-and-edit/review
import DateAndTimePage from '../../pages/appointments/create-and-edit/dateAndTimePage'
import SchedulePage from '../../pages/appointments/create-and-edit/schedulePage'
import getGroupAppointmentSeriesDetails from '../../fixtures/activitiesApi/getGroupAppointmentSeriesDetails.json'
import getOffenderAlerts from '../../fixtures/activitiesApi/getOffenderAlerts.json'
import getPrisonerAlerts from '../../fixtures/alertsApi/getPrisonerAlerts.json'
import getScheduledEvents from '../../fixtures/activitiesApi/getScheduledEventsMdi20230202.json'
import { formatDate } from '../../../server/utils/utils'
import CheckAnswersPage from '../../pages/appointments/create-and-edit/checkAnswersPage'
Expand Down Expand Up @@ -56,7 +56,7 @@ context('Duplicate appointment', () => {
JSON.parse('{"name": "John Smith", "username": "jsmith", "authSource": "nomis"}'),
)
cy.stubEndpoint('GET', '/appointment-series/10/details', getGroupAppointmentSeriesDetails)
cy.stubEndpoint('POST', '/api/bookings/offenderNo/MDI/alerts', getOffenderAlerts)
cy.stubEndpoint('POST', '/search/alerts/prison-numbers\\?includeInactive=false', getPrisonerAlerts)
cy.stubEndpoint('POST', `/scheduled-events/prison/MDI\\?date=${tomorrowFormatted}`, getScheduledEvents)
cy.stubEndpoint('POST', '/appointment-series', getAppointmentSeries)
})
Expand Down
8 changes: 4 additions & 4 deletions integration_tests/e2e/appointments/editAppointments.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import getPrisonPrisonersG0995GW from '../../fixtures/prisonerSearchApi/getPriso
import getPrisonPrisonersG6123VU from '../../fixtures/prisonerSearchApi/getPrisonPrisoners-MDI-G6123VU.json'
import getPrisonerG0995GW from '../../fixtures/prisonerSearchApi/getPrisoner-MDI-G0995GW.json'
import getPrisonerG6123VU from '../../fixtures/prisonerSearchApi/getPrisoner-MDI-G6123VU.json'
import getOffenderAlertsG0995GW from '../../fixtures/activitiesApi/getOffenderAlertsG0995GW.json'
import getOffenderAlertsG0995GWG6123VU from '../../fixtures/activitiesApi/getOffenderAlertsG0995GWG6123VU.json'
import getPrisonerAlertsG0995GW from '../../fixtures/alertsApi/getPrisonerAlertsG0995GW.json'
import getPrisonerAlertsG0995GWG6123VU from '../../fixtures/alertsApi/getPrisonerAlertsG0995GWG6123VU.json'
import getNonAssociationsBetweenG0995GWA1350DZ from '../../fixtures/nonAssociationsApi/getNonAssociationsBetweenG0995GWA1350DZ.json'
import getNonAssociationsBetweenG0995GWG6123VU from '../../fixtures/nonAssociationsApi/getNonAssociationsBetweenG0995GWG6123VU.json'
import getPrisonPrisonersG0995GWA1351DZ from '../../fixtures/prisonerSearchApi/postPrisonerNumbers-A1350DZ-G0995GW.json'
Expand Down Expand Up @@ -61,8 +61,8 @@ context('Edit appointment', () => {
cy.stubEndpoint('GET', '/prison/MDI/prisoners\\?term=saunders&size=50', getPrisonPrisonersG6123VU)
cy.stubEndpoint('GET', '/prisoner/G0995GW', getPrisonerG0995GW)
cy.stubEndpoint('GET', '/prisoner/G6123VU', getPrisonerG6123VU)
cy.stubEndpoint('POST', '/api/bookings/offenderNo/MDI/alerts', getOffenderAlertsG0995GW)
cy.stubEndpoint('POST', '/api/bookings/offenderNo/MDI/alerts', getOffenderAlertsG0995GWG6123VU)
cy.stubEndpoint('POST', '/search/alerts/prison-numbers\\?includeInactive=false', getPrisonerAlertsG0995GW)
cy.stubEndpoint('POST', '/search/alerts/prison-numbers\\?includeInactive=false', getPrisonerAlertsG0995GWG6123VU)
cy.stubEndpoint('POST', '/non-associations/between', getNonAssociationsBetweenG0995GWA1350DZ)
cy.stubEndpoint('POST', '/prisoner-search/prisoner-numbers', getPrisonPrisonersG0995GWA1351DZ)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import getScheduledEvents from '../../fixtures/activitiesApi/getScheduledEventsM
import getAppointmentSeries from '../../fixtures/activitiesApi/getAppointmentSeries.json'
import getGroupAppointmentSeriesDetails from '../../fixtures/activitiesApi/getGroupAppointmentSeriesDetails.json'
import getGroupAppointmentDetails from '../../fixtures/activitiesApi/getGroupAppointmentDetails.json'
import getOffenderAlerts from '../../fixtures/activitiesApi/getOffenderAlerts.json'
import getPrisonerAlerts from '../../fixtures/alertsApi/getPrisonerAlerts.json'
import getNonAssociationsBetweenA8644DYA1350DZ from '../../fixtures/nonAssociationsApi/getNonAssociationsBetweenA8644DYA1350DZ.json'
import HowToAddPrisonersPage from '../../pages/appointments/create-and-edit/howToAddPrisonersPage'
import ReviewPrisonersPage from '../../pages/appointments/create-and-edit/reviewPrisonersPage'
Expand Down Expand Up @@ -73,7 +73,7 @@ context('Create group appointment', () => {
'/users/jsmith',
JSON.parse('{"name": "John Smith", "username": "jsmith", "authSource": "nomis"}'),
)
cy.stubEndpoint('POST', '/api/bookings/offenderNo/MDI/alerts', getOffenderAlerts)
cy.stubEndpoint('POST', '/search/alerts/prison-numbers\\?includeInactive=false', getPrisonerAlerts)
cy.stubEndpoint('POST', '/non-associations/between', getNonAssociationsBetweenA8644DYA1350DZ)
})

Expand Down
1 change: 1 addition & 0 deletions integration_tests/e2e/health.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ context('Healthcheck', () => {
expect(response.body.checks.manageUsersApi).to.equal('OK')
expect(response.body.checks.bookAVideoLinkApi).to.equal('OK')
expect(response.body.checks.nonAssociationsApi).to.equal('OK')
expect(response.body.checks.alertsApi).to.equal('OK')
expect(response.body.checks.locationsInsidePrisonApi).to.equal('OK')
expect(response.body.checks.nomisMapping).to.equal('OK')
expect(response.body.checks.tokenVerification).to.contain({ status: 500, retries: 2 })
Expand Down
72 changes: 0 additions & 72 deletions integration_tests/fixtures/activitiesApi/getOffenderAlerts.json

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading