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

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

« Previous Version 6 Next »

Purpose

This WS is designed to update Innm (post).

APIary 

update-innm

Input parameters (filters)

  • id 
  • name (optional)
  • innm_identifier (optional)
  • status (optional)

    WS should work if there is at least one parameter present on payload.

Authorize

  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

Validate request (JSON schema)

Validate request using JSON schema (link !!! TBD)

Validate unique for Innms

  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 

      IF EXISTS(
      	SELECT * FROM medications M
      		INNER JOIN ingredients 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 according to payload parameters.

Return data structure:

  • id
  • name
  • innm_identifier
  • status
  • No labels