Table of Contents |
---|
...
- name
- form
- ingredients (array)
- id
- dosage info
- is_active_substance
Authorize
- Verify the validity of access token
- Check user scope (scope = 'medicationinnm:write') in order to perform this action
- In case error - generate 401 response
...
Invoke GetSubstanceByID($.ingredients[].id). Check exist any substance.is_active=FALSE.
if exists - return 422 error (message: "Substance in ingredients must be active!")
...
Calc count() where is_active_substance=TRUE in ingredients. Check count()=1.
if invalid - return 422 error (message: "One of ingredients must be is active substance!")
...
- 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 |