Specification
Patient request logic
- Only authenticated and authorized user can use this service
- New and Approved patient request can be rejected
- The request can be rejected only by the employee who works in the same legal entity in which the request was made.
Authorize user
- Verify the validity of access token
- Return 401 in case validation fails
- Check scopes in order to perform this action (scope = 'patient_request:write')
- Return 403 in case invalid scope(s)
Validate patient request
- Check that patient request with such ID exists in the system (is_active = true)
- In case of error - return 404
- Check that patient request belongs to the same legal entity as the user
- In case of error - return 403
Change patient request
- Change entity status in IL_DB.patient_request to REJECTED
Set updated_at - now() (Get current date-time)
Set updated_by - user_id (Extract user from token)