ЕСОЗ - публічна документація
PIS. Get Person request details_EN
Purpose
This WS designed to get details of person requests.
Specification
Authorization
Verify the validity of access token
Return (401, 'Invalid access token') in case of validation fails
Verify that token is not expired
in case of error - return (401, 'Invalid access token')
Check user scopes in order to perform this action (scope = 'person_request:details_pis')
Return (403, 'Your scope does not allow to access this resource. Missing allowances: person_request:details_pis') in case of invalid scope(s)
Check that token contains person_id
in case of error - return (401, 'Invalid access token')
Validate person
Get person_id from token (x-person-id header)
Validate patient status is active (status = ‘active' & is_active = 'true’)
in case of error - return 404 ('not found')
Validate Person request
Check that person request:
exists in il DB
belongs to patient
in case of error - return 404 ('not found')
Service logic
Get person_id
Get person request details from il.person_requests table by id
In case if
person_requests.documents
field contains not empty array - prepare data forurgent.documents
field in responseGet all
documents.[x].type
values from person requestInvoke Media Content Storage to generate upload URL for each document type from person request, add new links to response:
action:
PUT
bucket:
MEDIA_STORAGE_PERSON_REQUEST_BUCKET
resource_id:
person_request_id
resource_name:
person_request_#{type}.jpeg
Check existence of file for each type in Media content storage for person request
if file exists - set is_uploaded = true for document type in response
if file does not exist - set is_uploaded = false for document type in response
Render a response according to specification
ЕСОЗ - публічна документація