Add AddOnPurchaseType GraphQL
What does this MR do and why?
Add AddOnPurchaseType GraphQL
This MR adds new Graphql type AddOnPurchaseType.
Screenshots or screen recordings
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
- Check out the branch
- Create a new root group namespace
- Setup some seed records
namespace = Namespace.last
add_on = GitlabSubscriptions::AddOn.find_or_create_by!(name: "code_suggestions") {|e| e.description = "Test"}
add_on_purchase = GitlabSubscriptions::AddOnPurchase.create!(
add_on: add_on, namespace: namespace, expires_on: 1.month.from_now, quantity: 20, purchase_xid: 'A-S0001'
)
full_path = namespace.full_path # for graphql query input
- Go to graphql explorer: http://gdk.test:3000/-/graphql-explorer, and use following query and variables
{
namespace(fullPath: "graph-1") {
addOnPurchase(addOnName: "CODE_SUGGESTIONS") {
id
name
assignedQuantity
purchasedQuantity
}
}
}
- Check correct response is given.
- Assign add_on_purchase to user
add_on_purchase.assigned_users.create!(user: namespace.users.first)
- Check the response to have correct
assignedQuantity
- Change the add_on_type to all caps
CODE_SUGGESTIONS
, the response should be same - Change the namespace_id to invalid id or not owned by current user
- Response should be empty
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.
Related to #415749
Edited by Bishwa Hang Rai