Versions Compared

Key

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

Table of Contents

...

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

...

  1. if $.innm_identifier in payload - check unique by `innm_identifier`. 
    1. if  found - return 409 error (message: "Duplicate innm identifier!")

Validate statuses linked medication

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

  1. if $.status present in payload
    1. check availability linked medications 
    2. check status for linked medications 

      Code Block
      languagesql
      IF EXISTS(
      	SELECT * FROM medications M
      		INNER JOIN ingridients ING 
      			ON ING.medication_id == M.id
      				AND ING.innm_id == $.id
      				AND M.status != $.status
      )	


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

Update innm data

  1. Update innm data with payloadaccording to payload parameters.

Return data structure:

  • id
  • name
  • innm_identifier
  • status