Versions Compared

Key

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

...

  1. Verify the validity of access token

    1. Return 401 in case validation fails

  2. Check user scopes in order to perform this action (scope = 'merge_request:write')

    1. Return 403 in case invalid scope(s)

Validate merge request

  1. Validate merge request id exists in DB

    1. In case of error - return 404

  2. Check merge request status is NEW or APPROVED

    1. In case of error - return 422 (Incorrect status to reject merge request)

Validate employee

...

  1. the employee has created this merge request

...

  1. Select . Thus select inserted_atby from il.personmerge_requests of this merge request Compare user_id belongs to the same and compare it with user_id from the token.

  2. Check that client_id from the token maches with il.merge_requests.legal_entity_idwhere the merge request was created.

    1. If not match - return 422 error (User doesn’t belong to legal entity where the merge request was created)

Validate merge request

  1. Validate merge request id exists in DB

    1. In case of error - return 404

  2. Check merge request status is NEW or APPROVED

    1. In case of error - return 422 (Incorrect status to reject merge request)

Update object in DB

mpi.merge_requeststable

...