Skip to content

BE - Add mutation to update progress

Abhilash Kotte requested to merge be-add-mutation-to-update-progress into master

What does this MR do and why?

Adds a mutation to update progress for a work item Issue link - gitlab-org/incubation-engineering/okr/meta#8 (closed)

Screenshots or screen recordings

GraphQL mutation:

mutation {
  workItemUpdate(
    input: {id: "gid://gitlab/WorkItem/536", progressWidget: {progress: 13}}
  ) {
    workItem {
      ...WorkItem
      __typename
    }
    errors
    __typename
  }
}

fragment WorkItem on WorkItem {
  id
  iid
  title
  widgets {
    ...WorkItemWidgets
    __typename
  }
  __typename
}

fragment WorkItemWidgets on WorkItemWidget {
  ... on WorkItemWidgetProgress {
    type
    progress
    __typename
  }
}

GraphQL response

{
  "data": {
    "workItemUpdate": {
      "workItem": {
        "id": "gid://gitlab/WorkItem/536",
        "iid": "115",
        "title": "OBJ 68",
        "widgets": [
          {
            "__typename": "WorkItemWidgetHealthStatus"
          },
          {
            "type": "PROGRESS",
            "progress": 13,
            "__typename": "WorkItemWidgetProgress"
          },
          {
            "__typename": "WorkItemWidgetAssignees"
          },
          {
            "__typename": "WorkItemWidgetLabels"
          },
          {
            "__typename": "WorkItemWidgetDescription"
          },
          {
            "__typename": "WorkItemWidgetHierarchy"
          },
          {
            "__typename": "WorkItemWidgetMilestone"
          },
          {
            "__typename": "WorkItemWidgetNotes"
          }
        ],
        "__typename": "WorkItem"
      },
      "errors": [],
      "__typename": "WorkItemUpdatePayload"
    }
  }
}

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 Abhilash Kotte

Merge request reports