Skip to content

Add UserAddOnAssignmentBulkRemove Mutation

Mohamed Hamda requested to merge 442285-bulk-unassign-service into master

What does this MR do and why?

  • Add UserAddOnAssignmentBulkRemove Mutation

  • Add the bulk remove service

Related to #442285 and https://gitlab.com/gitlab-org/gitlab/-/issues/442286

The Approach here is either All-in or None.

If NO_ASSIGNMENTS_FOUND we don't do any bulk un-assignments, if not, we do bulk un-assignments.

Mutation Example:

NO_ASSIGNMENTS_FOUND Error

mutation {
  userAddOnAssignmentBulkRemove(
    input: {userIds: ["gid://gitlab/User/500"], addOnPurchaseId: "gid://gitlab/GitlabSubscriptions::AddOnPurchase/6"}
  ) {
    addOnPurchase {
      id
    }
    users {
      edges {
        node {
          id
          name
          username
        }
      }
    }
    errors
  }
}

Response

Screenshot_2024-03-20_at_14.36.35

SUCCESS

mutation {
  userAddOnAssignmentBulkRemove(
    input: {userIds: ["gid://gitlab/User/13", "gid://gitlab/User/19", "gid://gitlab/User/20"], addOnPurchaseId: "gid://gitlab/GitlabSubscriptions::AddOnPurchase/6"}
  ) {
    addOnPurchase {
      id
    }
    users {
      edges {
        node {
          id
          name
          username
        }
      }
    }
    errors
  }
}

Response

Screenshot_2024-03-20_at_14.40.59

Related to #442285

Edited by Mohamed Hamda

Merge request reports