Purpose
This WS is designed to update Innm (post).
APIary
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
- Verify the validity of access token
- Check user scope (scope = 'innm:write') in order to perform this action
- In case error - generate 401 response
Validate request (JSON schema)
Validate request using JSON schema (link !!! TBD)
Validate unique for Innms
- if $.innm_identifier in payload - check unique by `innm_identifier`.
- 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.
- if $.status present in payload
- check availability linked medications
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 )
- if found - return 409 error (message: "Status innm must be is equal statuses linked medications!")
Update innm data
- Update innm data according to payload parameters.
Return data structure:
- id
- name
- innm_identifier
- status