...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
Table of Contents |
---|
...
GraphQL
Purpose
This WS is designed to assign pair of master_person_id and person_id to a reviewer.
Statements
...
Table of Contents |
---|
Purpose
This WS is designed to assign pair of master_person_id and person_id to a reviewer.
Specification
Page Properties | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||
|
GraphQL schema
Expand | ||
---|---|---|
| ||
|
Logic
One assignee can have only one merge_request in status 'NEW'
One assignee can't have more than max_postponed_value marge_requests in status 'POSTPONED'
If assignee reach postponed_requests_limit, new merge_request can't be assigned to him
Assignee can't assign same merge_request more than once
Assignee can postpone merge request
Until assignee won't make final decision, assignee can't be change for merge_request
Authorize
Verify the validity of access token
in case of error return 401 ('Access denied')
Check user scope merge_candidate:assign in order to perform this action
in case of error generate 401 response ('Invalid scopes')
Headers
API paragraph not found
Request data validation
Verify role
Extract from token:
Validate client_id (is_blocked=false)
in case of error return 403 Error ('Client is blocked')
Check user_roles by client_id
check whether exist role NHS_REVIEWER
in case of error return 403 Error ('User doesn't have required role')
Identify User
Knowing token and client find user_id from mithril.users
Fetch manual_merge_candidate
From table manual_merge_candidate find:
Record in status = 'NEW'
Assignee_id=null
Priority by records which already has some decisions
join table manual_merge_requests
...
on manual_merge_requests.merge_candidate_id=manual_merge_candidates.merge_candidate_id
...
and manual_merge_requests.assignee_id<>$user_id
choose manual_merge_requests.merge_candidate_id order by
...
count()
...
DESC
manual_merge_candidate must satisfy constraint: merge_candidate_id+assignee_id in table manual_merge_requests
Validate request
Check whether this user doesn't have other merge_requests in status='NEW'
check manual_merge_requests by assignee_id=$user_id and status='NEW'
in case of error return conflict error 'CONFLICT' - 'Assignee is not allowed to ask for new merge request'
Check amount of postponed merge_requests for current employee_id
check qty from manual_merge_requests by assignee_id=$user_id and status='POSTPONED'
in case of qty<postponed_requests_limit return conflict error 'CONFLICT' - 'Assignee reached limit in postponed merge_requests'
Check there is no record for merge_candidate_id+assignee
...
_
...
- in case of such record exists return conflict error 'CONFLICT' - 'Assignee can review merge_request only once'
...
id and whether merge_candidate_id can be reviewed
...
verify merge_candidate_id has status NEW and assignee_id is null in table manual_merge_candidates
...
. in table manual_merge_requests shouldn't be a record with condition merge_candidate_id+$user_id
in case there is no merge candidate in status NEW which wasn't verified by $user_id return 204 No content
Processing
Update assignee for merge_candidate
Update assignee_id in manual_merge_candidates
...
to $user_id
Update updated_at = now()
Update updated_at = $user_id
manual_merge_candidates
Field | Value |
---|---|
assignee_id | $user_id |
updated_at | now() |
Make merge_request for assignee
Insert into table manual_merge_requests a record
column | value |
---|---|
id | UUID |
merge_candidate_id | $merge_candidate_id |
assignee_id | $user_id |
inserted_at | now() |
updated_at | now() |
status | NEW |
comment | null |
Add a record to audit log
After status was changed add new record to audit_log
field | value |
---|---|
id | generate UUID |
actor_id | $user_id |
resource | 'manual_merge_process' |
resource_id | |
changeset | {status:NEW} |
inserted_at | DATETIME |
Response structure
API paragraph not found
Post-processing processes
API paragraph not found
HTTP status codes
API paragraph not found