-
Notifications
You must be signed in to change notification settings - Fork 5
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
MAP-1625 enabling update of incidentDetails with incidentLocationId #725
Conversation
…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 } = |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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) | ||
|
There was a problem hiding this comment.
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
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.