7.9. Approve delete unit request Name Approve delete unit request Purpose Allow Approver to validate a unit delete request Linked user stories 4.39. Editor - Delete a unit 4.49. Approver - Approve deleted unit request 4.54. Organisation Approver - Approve deleted unit request for organisation APIs used PUT /units//approve PUT /units//reject PUT or PATCH /units/ Scope This process only handles the validation of an already created unit deletion request Roles System, Approver / Global Approver Input - id of the unit that is marked for deletion - optionally the information to amend Output - confirmation that the update request has been approved/rejected Detailed Process description Main Process Step Description Actor(s) Input(s) Output(s) Decision points 1 The System sends out notifications to the Global approvers and organisation approvers, indicating that an approval a pending. System - Outside trigger (e.g. Editor sent a delete request) - notification to the Global and organisation Approvers 2 The Approver verifies if the unit can be deleted Approver - unit deletion request - yes / no If the unit can be deleted: Go to step 3 Else: Go to secondary process S.1 3 The System marks the unit with the flag “is_deleted = true” and adds the information on the date of validation and the user that validated the request System - unit with flag “marked_for_deletion = true” - unit with flag “is_deleted = true” - approver set to the user that triggered the approval - approval date set to the current date 4 The System sets all the quipments linked to the site with the flag “is_deleted = true”. System - unit - all linked equipments marked with the flag “is_deleted = true” 5 The System creates validated update requests with the flag “is_deleted = true” for each active physical link that are linked to the deleted equipments System - unit - new validated physical links with the flag “is_deleted = true” for each active physical link that is linked to the deleted equipments 6 The Approver gets a confirmation that the approval has been applied Approver - confirmation of the validation Secondary Processes S.1. Delete unit request rejected Step Description Actor(s) Input(s) Output(s) Decision points 1 The System removes the mark_for_deletion tag from the unit entry System - unit marked for deletion - unit with the flag “mark_for_deletion = false” 2 The Approver gets a confirmation that the deletion rejection has been applied Approver - deletion request rejection confirmation Exceptions [400 Bad Request] Invalid input: If mandatory fields are missing or invalid, the system returns an error message. If some addresses do not exist in the system, this is also considered as a bad request. [404 Not Found] Unit not found Error returned by the system if the unit is not found. [409 Conflict] Unit not marked for deletion Error returned by the system if the unit being validated is not marked for deletion. [500 Internal Server Error] System Error If the system fails to save changes due to an internal error, it displays an appropriate message and logs the error for further investigation.