Versions Compared

Key

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

Table of Contents
Status

  • Specification 
    Status
    colourGreen
    titledone
  • Apiary 
    Status
    colourGreen
    titleDone
  • JSON sh
    Status
    colourGreen
    titledone

Purpose

This WS is designed to update substance (post).

APIary 

update-substance

Input

...

parameters 

  • id 
  • name
  • name_original
  • innm_identifier
  • is_active

...

  1. Verify the validity of access token
  2. Check user scope (scope = 'substance:write') in order to perform this action
    1. In case error - generate 401 response

...

  1. Check exist substance by if $.id in payload
    1. if  found - return 409 error (message: "Substance does not exist!")

Validate statuses linked medication

Purpose validation:  Status innm must be equal to statuses linked medication.

  1. Get `is_active` medications (linked with substance) in the opposite $.is_active in payload
    1.  

      Code Block
      languagesql
      IF EXISTS(
      	SELECT * FROM medications M
      	WHERE M.type == INNM
      		AND M.ingridients.id = $.id
      		AND M.is_active != $.is_active
      )	


    2. if found -  return 409 error (message: "Status innm must be equal to statuses linked medications!")

Update substance data

  1. Update substance data according to payload parameters.

...