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

Skip to end of metadata
Go to start of metadata

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

Compare with Current View Page History

« Previous Version 6 Next »

Status

Specification
DONE
Apiary
DONE
JSON Schema request
DONE
JSON Schema response
SPECS


Purpose

This WS is designed to create new innm (post).


APIary 

create-innm

Input parameters 

  • name
  • form
  • ingredients (array)

Authorize

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

Validate request (JSON schema)

  1. Validate request using JSON schemas (new_medication_type_innm_schema.json):
    1. Return 422 with list of validation errors in case validation fails (422 EView)

Validate FK 

Purpose validation: Check on existing Substance/Innm in ingredients 

  1. For Check exist `Substance` by $.ingredients[].id.

    1. if invalid - return 422 error (message: "Substance in ingredients is not found!")

Create new Medication

  1. Create new record in Medications 
  2. Fill data 

Destination

Source

id
name$.name
typeINNM
is_active TRUE
form$.form
ingredients$.ingredients
containerNULL
package_qtyNULL
package_min_qtyNULL
code_atcNULL
manufacturerNULL
certificate NULL
expired_certificate_atNULL
inserted_at:timestamp
inserted_byuser_id
updated_at:timestamp
updated_byuser_id

Prepare & return response data structure

  1. Fill response WS data structure 
  2. Validate response using JSON schemas (!!! TBD)
    1. Return 422 with list of validation errors in case validation fails (422 EView)
  • No labels