Skip to content

Draft: [WIP] Spike - Enhanced Bulk Assignment API

Vamsi Vempati requested to merge spike-enhanced-bulk-assignment-be into master

What does this MR do and why?

Spike for https://gitlab.com/gitlab-org/fulfillment/meta/-/issues/1488+

This MR contains changes related to only Bulk Assignment from the original Spike MR.

Includes:

Note: This is not production ready code and is only meant for feasibility check and estimation.

GraphQL

Bulk Create

mutation userAddOnAssignmentBulkCreate($input: UserAddOnAssignmentBulkCreateInput!, $addOnPurchaseIds: [GitlabSubscriptionsAddOnPurchaseID!]!) {
  userAddOnAssignmentBulkCreate(input: $input) {
    errors
    clientMutationId
    addOnPurchase {
      id
      name
      purchasedQuantity
      assignedQuantity
    }
    users {
      nodes {
        id
        addOnAssignments(addOnPurchaseIds: $addOnPurchaseIds) {
          nodes {
            addOnPurchase {
              name
            }
          }
        }
      }
    }
  }
}
{
  "input": {
    "userIds": [
      "gid://gitlab/User/43",
      "gid://gitlab/User/107",
    ],
    "addOnPurchaseId": "gid://gitlab/GitlabSubscriptions::AddOnPurchase/2"
  },
  "addOnPurchaseIds": [
    "gid://gitlab/GitlabSubscriptions::AddOnPurchase/2"
  ]
}

Bulk Remove

mutation userAddOnBulkAssignmentRemove($input: UserAddOnAssignmentBulkRemoveInput!, $addOnPurchaseIds: [GitlabSubscriptionsAddOnPurchaseID!]!) {
  userAddOnAssignmentBulkRemove(input: $input) {
    errors
    clientMutationId
    addOnPurchase {
      id
      name
      purchasedQuantity
      assignedQuantity
    }
    users {
      nodes {
        id
        addOnAssignments(addOnPurchaseIds: $addOnPurchaseIds) {
          nodes {
            addOnPurchase {
              name
            }
          }
        }
      }
    }
  }
}
{
  "input": {
    "userIds": [
      "gid://gitlab/User/43",
      "gid://gitlab/User/107",
      "gid://gitlab/User/97",
    ],
    "addOnPurchaseId": "gid://gitlab/GitlabSubscriptions::AddOnPurchase/2"
  },
  "addOnPurchaseIds": [
    "gid://gitlab/GitlabSubscriptions::AddOnPurchase/2"
  ]
}

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Vamsi Vempati

Merge request reports

Loading