Add create achievement GraphQL mutation
What does this MR do and why?
Checkout the issue/epic for some more background: #385381 (closed) / &9429
This merge request introduces the AchievementsCreate
mutation, along with the AchievementType
and exposes achievements
against NamespaceType
.
Screenshots or screen recordings
How to set up and validate locally
To create an achievement (you need to be a group maintainer+):
You will need to send a GraphQL request containing a file using something like Postman.
URL: http://gdk.test:3000/api/graphql
Method: POST
Headers: Be sure to add a PRIVATE-TOKEN with maintainer+ access
Body: form-data:
operations: {"query": "mutation achievementsCreate($file: Upload!) { achievementsCreate(input: { namespaceId: \"gid://gitlab/Namespace/31\" name: \"Leading organization\" revokeable: true avatar: $file }) { errors achievement { id avatarUrl } } }", "variables": {"file": null}}
map: {"0": ["variables.file"]}
0: select file from the dropdown then select the image file you want to use as the avatar/badge
You can query using GraphQL explorer, but won't be able to create new achievements as I don't believe there is a way to upload files at the moment.
Use http://gdk.test:3000/-/graphql-explorer
query{
namespace(fullPath: "flightjs") {
achievements {
nodes {
id
name
avatar
description
revokeable
}
}
}
}
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.