ЕСОЗ - публічна документація

Deactivate INNM_WP

Purpose

This WS allows to deactivate INNM by NHS employee. 

Key points

  1. This is a graphQl mutation used in Administration panel only.

  2. Only authenticated and authorized NHS employee with appropriate scope can deactivate INNM.

  3. Before deactivation of INNM should be deactivated related Innm Dosage, Medications and Program medication of the Medical program.

Specification

Link

graphQl mutation

Посилання на Apiary або Swagger

Resource

graphQl mutation

Посилання на ресурс, наприклад: /api/persons/create

Scope

innm:deactivate

Scope для доступу

Components

Drugs and Program medications

Зазначається перелік бізнес компонентів, які використовують цей метод, наприклад: ePrescription

Microservices

API paragraph not found

Перелік мікросервісів, які використовує метод API, наприклад: Auth, ABAC

Protocol type

API paragraph not found

Тип протоколу, який використовується запитом, наприклад: SOAP | REST

Request type

API paragraph not found

Тип запиту API, наприклад: GET, POST, PATCH…

Sync/Async

API paragraph not found

Метод є синхронним чи асинхронним?

Public/Private/Internal

Internal

Потрібно зазначити тип методу за ступенем доступності

""" Input for `deactivateINNM` mutation. User must have scopes **innm:deactivate** """ input DeactivateINNMInput { "The ID of an object" id: ID! } """ Return type for `deactivateINNM` mutation. """ type DeactivateINNMPayload { "Deactivated `innm`." innm: INNM }

Logic

  1. Update innms record by $.id  set values:

Source

 

Source

 

is_active

FALSE

updated_at

user_id

updated_by

timestamp

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 = 'innm:deactivate')

    • Return (403, 'You don't have permission to access this resource: innm:deactivate') in case of invalid scope(s)

Request data validation

Validate client

  • Extract client_id from token.

  • Check client scopes has innm:deactivate

    • in case of error - return 403 (“You don’t have permission to access this resource: innm:deactivate”)

  • Check legal entity type (type = NHS)

    • In case of error - return 403 ('You don’t have permission to access this resource')

Validate innm

Check there is an UUID value that:

  • Check that innm exists

    1. in case error - return 404 ('Innm is not found!')

  • Check that innm is active (is_active = 'true')

    1. in case error - return 409 ('Innm should be active')

Validate linked innm_dosage 

  1. Get all active linked medications (with type = innm_dosage):

IF EXIST ( SELECT * FROM MEDICATIONS M WHERE M.is_active == TRUE AND M.type == INNM_DOSAGE AND (M.ingridients.id = $.id AND M.ingridients.is_primary) )

In case of error - return 409 ('All linked innm_dosage should be inactive')

HTTP status codes

HTTP status code

Message

What caused the error

HTTP status code

Message

What caused the error

 401

 Invalid access token

 

 403

  •  You don't have permission to access this resource: innm:deactivate

  • You don’t have permission to access this resource

 

404

Innm is not found!

 

409

  • Innm should be active

  • All linked innm_dosage should be inactive

 

ЕСОЗ - публічна документація