Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Purpose

This process is designed for NHS admin to deactivate declaration manually.

Apiary

https://uaehealthapi.docs.apiary.io/#reference/internal.-ops-db/declarations/terminate-declarations-by-employee-or-person

Authorize user

  1. Verify the validity of access token
  2. Check user scopes declaration:terminate in order to perform this action
    1. In case error - generate 401 response

Validate request

One parameter of employee_id and person_id must be set

Validate person

  1. Search person by $.id
    1. in case error return 404
  2. Search declaration by $.person_id
    1. in case error return 404
  3. Check declaration status = active
    1. in case error return 422. Message:"declaration status is not active"

Validate employee

  1. Search employee by$.id
    1. in case error return 404
  2. Check if employee is an active doctor (employee_type=DOCTOR and is_active=true)
    1. in case error return 422. Message:"Employee is not an active doctor"
  3. Select all active declarations by $.employee_id
    1. in case error return 422. Message:"Employee does not have active declarations"

Terminate declaration

  1. Change declaration status to `terminated`
  2. Change reason to `Manual`