Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Specification

...

    1. Verify the validity of access token
      1. in case of error return 401 ('Access denied')
    2. Check user scope merge_candidate:assign in order to perform this action
      1. in case of error generate 401 response ('Invalid scopes')

Verify role

Extract from token:

...

  1. Priority by records which already has some decisions 
    1. 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
    2. choose manual_merge_requests.merge_candidate_id  order by  count() DESC
  2. manual_merge_candidate must satisfy constraint: merge_candidate_id+assignee_id in table manual_merge_requests


Validate request

  1. Check whether this user doesn't have other merge_requests in status='NEW'
    1. check manual_merge_requests by assignee_id=$user_id and status='NEW'
      1. in case of error return conflict error 'CONFLICT' - 'Assignee is not allowed to ask for new merge request'
  2. Check amount of postponed merge_requests for current employee_id
    1. check qty from manual_merge_requests by assignee_id=$user_id and status='POSTPONED'
      1. in case of qty<postponed_requests_limit return conflict error 'CONFLICT' - 'Assignee reached limit in postponed merge_requests'
  3. Check there is no record for merge_candidate_id+assignee_id 
    1. in table manual_merge_requests fetch a record by condition merge_candidate_id+$user_id
      1. in case of such record exists return conflict error 'CONFLICT' - 'Assignee can review merge_request only once'
  4. Check whether merge_candidate_id can be reviewed
    1. verify merge_candidate_id has status NEW and assignee_id is null in table manual_merge_candidates
      1. in case of error return conflict error 'CONFLICT' - 'Invalid merge_request to be reviewed'

...

Update assignee for merge_candidate

  1. Update assignee_id in manual_merge_candidates  to $employee_id
  2. Update updated_at = now()
  3. Update updated_at = $user_id

manual_merge_candidates

Field Value
assignee_id$user_id
updated_atnow()
updated_at$user_id


Make merge_request for assignee

...

column
value
idUUID
merge_candidate_id$merge_candidate_id
assignee_id$user_id
inserted_atnow()
updated_atnow()
statusNEW
commentnull



Add a record to audit log

After status was changed  add new record to audit_log

field
value
idgenerate UUID
actor_id$user_id
resource'manual_merge_process'
resource_id$manual_merge_process.id
changeset{status:NEW}
inserted_atDATETIME