Draft: Spike bulk assignment endpoints for add ons
What does this MR do and why?
Spike for https://gitlab.com/gitlab-org/gitlab/-/issues/423839+
GraphQL
List Users
query getEligibleUsers($fullPath: ID!, $addOnPurchaseIds: [GitlabSubscriptionsAddOnPurchaseID!]!) {
namespace(fullPath: $fullPath) {
addOnEligibleUsers(addOnType: CODE_SUGGESTIONS) {
nodes {
id
username
name
addOnAssignments(addOnPurchaseIds: $addOnPurchaseIds) {
nodes {
addOnPurchase {
name
}
}
}
}
}
}
}
{
"addOnPurchaseIds": [
"gid://gitlab/GitlabSubscriptions::AddOnPurchase/2"
],
"fullPath": "<GROUP-PATH>"
}
Bulk Create
mutation userAddOnAssignmentBulkCreate($input: UserAddOnAssignmentBulkCreateInput!, $addOnPurchaseIds: [GitlabSubscriptionsAddOnPurchaseID!]!) {
userAddOnAssignmentBulkCreate(input: $input) {
errors
clientMutationId
addOnPurchase {
id
name
purchasedQuantity
assignedQuantity
}
users {
nodes {
name
addOnAssignments(addOnPurchaseIds: $addOnPurchaseIds) {
nodes {
addOnPurchase {
id
name
}
}
}
}
}
}
}
{
"input": {
"userIds": [
"gid://gitlab/User/43",
"gid://gitlab/User/107",
"gid://gitlab/User/97",
"gid://gitlab/User/108",
"gid://gitlab/User/94",
"gid://gitlab/User/46",
"gid://gitlab/User/47",
"gid://gitlab/User/48",
"gid://gitlab/User/49"
],
"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 {
name
addOnAssignments(addOnPurchaseIds: $addOnPurchaseIds) {
nodes {
addOnPurchase {
id
name
}
}
}
}
}
}
}
{
"input": {
"userIds": [
"gid://gitlab/User/43",
"gid://gitlab/User/107",
"gid://gitlab/User/97",
"gid://gitlab/User/108",
"gid://gitlab/User/94",
"gid://gitlab/User/46",
"gid://gitlab/User/47",
"gid://gitlab/User/48",
"gid://gitlab/User/49"
],
"addOnPurchaseId": "gid://gitlab/GitlabSubscriptions::AddOnPurchase/2"
},
"addOnPurchaseIds": [
"gid://gitlab/GitlabSubscriptions::AddOnPurchase/2"
]
}
Filter by Group ID
query getEligibleUsers($fullPath: ID!, $addOnPurchaseIds: [GitlabSubscriptionsAddOnPurchaseID!]!, $filterByGroupId: GroupID!) {
namespace(fullPath: $fullPath) {
addOnEligibleUsers(addOnType: CODE_SUGGESTIONS, filterByGroupId: $filterByGroupId) {
nodes {
id
username
name
addOnAssignments(addOnPurchaseIds: $addOnPurchaseIds) {
nodes {
addOnPurchase {
name
}
}
}
}
}
}
}
{
"addOnPurchaseIds": [
"gid://gitlab/GitlabSubscriptions::AddOnPurchase/2"
],
"fullPath": "group-with-too-many-users",
"filterByGroupId": "gid://gitlab/Group/513"
}
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.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Josianne Hyson