Specification
GraphQL
Purpose
This WS is designed to review and update assign merge_request.
Statements
- Assignee can postpone merge_request change its status to POSTPONE
- POSTPONE is not final status and must be changed to one of MERGE, SPLIT, TRASH
- MERGE, SPLIT, TRASH are final statuses
- In case one of MERGE, SPLIT, TRASH for one merge_request reached decision_amount value this request must be processed
- Decisions with status SPLIT and TRASH changes Merge Candidates to PROCESSED
- Decisions with status MERGE changes Merge Candidates to PROCESSED and creates Merge Job
Authorize
- Verify the validity of access token
- in case of error return 401 ('Access denied')
- Check user scope merge_request:review in order to perform this action
- in case of error generate 401 response ('Invalid scopes')
- Verify the validity of access token
Verify user and 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
- Validate client_id is NHS
- check client type is NHS
- in case of error rerun forbidden error (Client is not allowed to the action')
- check client type is NHS
Validate request
- Check allowed status transitions:
- from NEW to POSTPONE/SPLIT/MERGE/TRASH
- from POSTPONE to SPLIT/MERGE/TRASH
- in case of other transitions return CONFLICT error - 'Incorrect updated status'
Response
Update manual_merge_requests a record by ID
column | value |
---|---|
updated_at | now() |
status | $status |
comment | $comment |
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 | $manual_merge_process.id |
changeset | {status:$status} |
inserted_at | DATETIME |
Check amount of decisions
In case status was changed to final SPLIT/MERGE/TRASH recalculate how many decisions on this merge_request was made by each status (qty).
Compare calculated qty to decision_amount. If qty=decision_amount:
- update manual_merge_candidates
Field | Value |
---|---|
status | $PROCESSED |
updated_at | now() |
updated_by | $user_id |
decision | $status (by calculated qty) |
2. Add even to terminate declaration and dectivate person by person_id to Kafka