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

MAP-1625 enabling update of incidentDetails with incidentLocationId #725

Conversation

GurnankCheema
Copy link
Contributor

This code change is to allow users to add the incidentLocationId to existing reports. The trigger for the action is by calling /update-location-id followed by /1/9, where 1 is the reportId id to start from and 9 the reportId to end on.

The incidentLocationId is obtained from the nomis-sync-prisoner-mapping api. The only part of the report that will change is the form_response.incidentDetails.
Any reports that already have the incidentLocationId will not change.

The actual update action in the database uses the already available functionality used when we edit reports.

…ails

Old UoF reports that currently store the locationId will also now store the incidentLocationId. The incidentLocationId is obtained from the nomis-sync-prisoner-mapping api.
The only part of the report that will change is the form_response.incidentDetails
Any reports that already have the incidentLocationId will not change.
} else if (locationId) {
const token = await this.systemToken(req.user.username)

const { dpsLocationId } =
Copy link
Contributor Author

@GurnankCheema GurnankCheema Oct 15, 2024

Choose a reason for hiding this comment

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

L33 get the new location id from the locations-inside-prison-api that maps to the old nomis location id

const { dpsLocationId } =
await this.nomisMappingService.getDpsLocationDetailsHavingCorrespondingNomisLocationId(token, locationId)

report.form.incidentDetails.incidentLocationId = dpsLocationId
Copy link
Contributor Author

Choose a reason for hiding this comment

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

L36 add the new location id to the incidentDetails part of the report. No other parts of incidentDetails will change


const updatedSection = report.form.incidentDetails

await this.reportService.update(res.locals.user, reportId, 'incidentDetails', updatedSection)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

L40 , the update function is existing functionality that is used for editing reports

const updatedSection = report.form.incidentDetails

await this.reportService.update(res.locals.user, reportId, 'incidentDetails', updatedSection)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have started all the logs with the word 'Ad-hoc' just to be able to target them more easily

@GurnankCheema GurnankCheema merged commit f4fd560 into main Oct 15, 2024
9 checks passed
@GurnankCheema GurnankCheema deleted the MAP-1625-UOF-add-new-incident-location-id-to-existing-reports branch October 15, 2024 14:37
GurnankCheema added a commit that referenced this pull request Oct 16, 2024
jnioche-jd pushed a commit that referenced this pull request Oct 16, 2024
* Revert "MAP-1625 get report using db query that doesn't require user (#726)"

This reverts commit acea4e5.

* Revert "MAP-1625 set up routing and controller enabling update of incidentDetails (#725)"

This reverts commit f4fd560.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants