Table of Contents |
---|
Specification
...
- 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')
- Verify the validity of access token
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')
- check whether exist role NHS_REVIEWER
...
- 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<>$userid<>$employee_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 employee doesn't have other merge_requests in status='NEW'
- check manual_merge_requests by assignee_id=$employee_id and status='NEW'
- in case of error return conflict error 'CONFLICT' - 'Assignee is not allowed to ask for new merge request'
- check manual_merge_requests by assignee_id=$employee_id and status='NEW'
- Check amount of postponed merge_requests for current employee_id
- check qty from manual_merge_requests by assignee_id=$employee_id and status='POSTPONED'
- in case of qty=postponed<postponed_requests_limit return conflict error 'CONFLICT' - 'Assignee reached limit in postponed merge_requests'
- check qty from manual_merge_requests by assignee_id=$employee_id and status='POSTPONED'
- Check there is no record for merge_candidate_id+assignee_id
- in table manual_merge_requests fetch a record by condition merge_candidate_id+$employee_id
- in case of such record exists return conflict error 'CONFLICT' - 'Assignee can review merge_request only once'
- in table manual_merge_requests fetch a record by condition merge_candidate_id+$employee_id
- Check 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 case of error return conflict error 'CONFLICT' - 'Invalid merge_request to be reviewed'
- verify merge_candidate_id has status NEW and assignee_id is null in table manual_merge_candidates
...
Update assignee for merge_candidate
- Update assignee_id in manual_merge_candidates to $employee_id
- Update updated_at = now()
- Update updated_at = $user_id
manual_merge_candidates
Field | Value |
---|---|
assignee_id | $employee_id |
updated_at | now() |
updated_at | $user_id |
Make merge_request for assignee
...