Table of Contents |
---|
Purpose
This process is designed for NHS admin to deactivate declaration manually.
Apiary
Authorize user
- Verify the validity of access token
- Check user scopes declaration:terminate in order to perform this action
- In case error - generate 401 response
Validate request
One parameter of employee_id
and person_id
must be set
Validate person
- Search person by $.id
- in case error return 404
- Search declaration by $.person_id
- in case error return 404
- Check declaration status = active
- in case error return 422. Message:"declaration status is not active"
Validate employee
- Search employee by$.id
- in case error return 404
- Check if employee is an active doctor (employee_type=DOCTOR and is_active=true)
- in case error return 422. Message:"Employee is not an active doctor"
- Select all active declarations by $.employee_id
- in case error return 422. Message:"Employee does not have active declarations"
Terminate declaration
- Change declaration status to `terminated`
- Change reason to `Manual`