Table of Contents |
---|
Purpose
The method is used to approve or reject employee request.
Specification
Page Properties | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||||||||||
|
Logic
...
Sample Request
Code Block | ||
---|---|---|
| ||
curl -X POST -H 'Content-Type: application/json' -H 'Authorization:Bearer YW5WcFkyVnFkV2xqWldwMWFXTmxDZzpjY1hwWTR0cWRZbGVjNHAxYUdsMXVJ' 'http://ehealth.nebo15.com/employee_requests/d290f1ee-6c54-4b01-90e6-d701748f0851/actions/approve' |
Input parameters
Input parameter | Values | Type | Description | Example |
---|---|---|---|---|
id | String | Required | d290f1ee-6c54-4b01-90e6-d701748f0851 | |
action |
| String | Required | APPROVE |
Authorize
Verify the validity of access token
Check user scope employee_request:update in order to perform this action
In case error - return 401 error
Headers
Наприклад:
Content-Type:application/json
Authorization:Bearer YW5WcFkyVnFkV2xqWldwMWFXTmxDZzpjY1hwWTR0cWRZbGVjNHAxYUdsMXVJ
Request data validation
Check action in request
if action = APPROVE, add user new role
if action - REJECT, update employee request status on REJECTED
Processing
Update employee request status to REJECTED
Invoke WS to update employee request status with parameter 'action'='reject'
See service specification
Sample Request
Code Block | ||
---|---|---|
| ||
curl -X PATCH -H 'Content-Type: application/json' 'http://ehealth.nebo15.com/employee_requests/d290f1ee-6c54-4b01-90e6-d701748f0851/actions/reject' |
Get Employee Request Details
Invoke WS Get Employee Request by ID for further employee creation
See See service specification
Sample Request
Code Block | ||
---|---|---|
| ||
curl -X GET -H 'Content-Type: application/json' 'http://ehealth.nebo15.com/employee_requests/d290f1ee-6c54-4b01-90e6-d701748f0851' |
Create user in Auth
Create user in Auth
Create/Update employee
...
Search party_id by tax_id (tax_id or passport_number) and birth_date for deduplication Party
If found, update object party - Update party WS
If not found, - Create object party
Update Party. See specification
The following fields can't be changed:
tax_id (tax_id or passport_number)
birth_date
If doctor object in ER is null, don't update party.eductions/party.qualifications/party.specialities/party.science_degree. Otherwise update those objects.
if about_myself/working_experience is null or empty string - don't update correspondent fields in parties.
Create party WS. See specification
create related entity party-user in PRM
Chech employee_id in request
if employee_id is exist in request, Update employee.
if employee_id is not exist, Create employee.
Update employee. See specification
The following fields can't be changed:
employee_type
legal_entity_id
start_date
if employee_type = 'DOCTOR', 'SPECIALIST' or 'ASSISTANT' update doctor object
if one of next fields were changed:
first_name
second_name
last_name
find contracts with contractor_owner_id=$owner_id and status='VERIFIED'. Set ops.contracts.is_suspended=true
Create new employee. See specification
If (employee_type = OWNER || employee_type = PHARMACY_OWNER) : deactivate all other records with the employee_type = OWNER
or employee_type = PHARMACY_OWNER for the legal_entity,
where new owner is creating:
...
In case new OWNER was added find contracts with contractor_owner_id=$old_owner_id and status='VERIFIED'.
Set ops.contracts.is_suspended=true
Create related entity party-user
Create related entity party-user
...
If not - return 422 error: "Email is already used by another person"
Add role
Add user role by invoke service - название метода
...
See service logic
See service spesificationspecification
Sample Request
Code Block | ||
---|---|---|
| ||
curl -X POST -H 'Content-Type: application/json' -d '{ "role": "doctor", "client_id": "b075f148-7f93-4fc2-b2ec-2d81b19a9b7b" }' 'https://trump.herokuapp.com/admin/parties/b075f148-7f93-4fc2-b2ec-2d81b19a9b7b/add_role' |
Update employee request status to APPROVED
Invoke WS to update employee request status with parameter 'action'='approve'
See service specification
Sample Request
Code Block | ||
---|---|---|
| ||
curl -X PATCH -H 'Content-Type: application/json' 'http://ehealth.nebo15.com/employee_requests/b075f148-7f93-4fc2-b2ec-2d81b19a9b7b/actions/approve' |
Send Email
Send email with successful registration using WS - Send Message (TBD)
Temporarily use Postmark
Response structure
Example:
Expand | ||
---|---|---|
| ||
|
Post-processing processes
API paragraph not found
HTTP status codes
Page Properties | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||
|