feat(workitems): Add Children field to WorkItem struct.
What does this MR do?
Adds support for a work item's child items to WorkItemsService, and
refactors the shared GraphQL parent/linked-item unwrapping logic that
this feature builds on.
workItemIIDGQL extraction (cleanup)
Adds a shared workItemIIDGQL type with an unwrap() method that
parses the GraphQL iid/namespace.fullPath pair into a
WorkItemIID. This replaces the duplicated anonymous parent/workItem
structs previously defined inline in workItemWidgetHierarchyGQL and
workItemWidgetLinkedItemsGQL, and simplifies
workItemWidgetLinkedItemsGQL.unwrap() by delegating IID/namespace
parsing to workItem.unwrap() instead of parsing manually.
workItemWidgetHierarchyGQL.unwrap is renamed to unwrapParent, to
free up the name for the new children logic below.
Children support (feature)
Adds a Children []WorkItemIID field to WorkItem, populated from
the hierarchy widget's hasChildren/children fields — mirroring
the existing Parent support. Adds
workItemWidgetHierarchyGQL.unwrapChildren(), which returns nil when
HasChildren is false and otherwise maps each child node through
workItemIIDGQL.unwrap().
Extends the hierarchy widget selection in workItemTemplate and in
the get_workitem, list_work_items, create_work_item, and
update_work_item GraphQL test fixtures with hasChildren and
children { nodes { iid namespace { fullPath } } }.
Testing
- Updated
testdata/get_workitem.jsonwith a sample child work item - Updated
TestGetWorkItem_SuccessfulResponseto assertChildrenis populated correctly
Related issues
Closes #2276 (closed)