Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

Purpose

This method is designed to obtain all Employees of the legal entity.

Specification

Apiary

Authorization

  • Verify the validity of access token

    • Return (401, 'Invalid access token') in case of validation fails

  • Verify that token is not expired

    • in case of error - return (401, 'Invalid access token')

  • Check user scopes in order to perform this action (scope = 'employee:details')

    • Return (403, 'Your scope does not allow to access this resource. Missing allowances: employee:details') in case of invalid scope(s)

Service logic

Service returns specified Employee related to the legal entity from token:

  1. Get Employee by ID from prm.employees

    1. Filter by medication_request_id and patient_id and status (optional)

  2. Validate data consistency:

    1. Ensure that requested Employee relates to the legal entity from token:

      1. Return 403 ('Access denied') in case of error

  3. Render a response according to specification with found Employee:

    1. render a response structure depends on employee types

    2. get parties.specialities, for each  parties.specialities.speciality check condition if parties.specialities.speciality<>employee.speciality.speciality then set speciality_officio=false and add to employees.speciality else don't add to response.

Response structures for Employee types

DOCTOR, SPECIALIST, ASSISTANT, PHARMACIST, MED_ADMIN, LABORANT or MED_COORDINATOR

...