Table of Contents |
---|
...
- Verify the validity of access token
- Check user scope (scope = 'innm:write') in order to perform this action
- In case error - generate 401 response
...
- 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
Code Block language sql IF EXISTS( SELECT * FROM medications M INNER JOIN ingridients 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 with payloadaccording to payload parameters.
Return data structure:
- id
- name
- innm_identifier
- status