Status
Purpose
This WS is designed to create new innm (post).
APIary
Input parameters
- name
- form
- ingredients (array)
- id
- dosage info
- is_active_substance
Authorize
- Verify the validity of access token
- Check user scope (scope = 'medication:write') in order to perform this action
- In case error - generate 401 response
Validate request (JSON schema)
- Validate request using JSON schemas (new_medication_type_innm_schema.json):
- Return 422 with list of validation errors in case validation fails (422 EView)
Validate FK
Purpose validation: Check on existing Substance/Innm in ingredients
For Check exist `Substance` by $.ingredients[].id.
if invalid - return 422 error (message: "Substance in ingredients is not found!")
Create new Medication
- Create new record in Medications
- Fill data
Destination | Source |
---|---|
id | |
name | $.name |
type | INNM |
is_active | TRUE |
form | $.form |
ingredients | $.ingredients |
container | NULL |
package_qty | NULL |
package_min_qty | NULL |
code_atc | NULL |
manufacturer | NULL |
certificate | NULL |
expired_certificate_at | NULL |
inserted_at | :timestamp |
inserted_by | user_id |
updated_at | :timestamp |
updated_by | user_id |
Prepare & return response data structure
- Fill response WS data structure
- Validate response using JSON schemas (!!! TBD)
- Return 422 with list of validation errors in case validation fails (422 EView)