vsteam icon indicating copy to clipboard operation
vsteam copied to clipboard

Allow to Update-VSTeamWorkItem to add relations with other work items

Open mnieto opened this issue 1 year ago • 6 comments

PR Summary

This PR is related to #518 Adding the below changes around the Update-VSTeamWorkItem to enable adding relations to another workitems. This could be achived using:

  • Update-VSTeamWorkItem: allows mix field changes and relations changes
  • *-VSTeamWorkItemLink: allow a simplified way to manage relations of a work item

Proposed added/modified cmdlets:

  • Update-VSTeamWorkItem: add a -Relations parameter
  • Get-VSTeamWorkItemRelationTypes: list Relations types. Paramerters:
    • Usage: All|resourceLink|workItemLink. Default workItemLink
  • New-VSTeamWorkItemRelation: Helper cmdlet that creates an in-memory object to facilitate building the -Relations parameter in Update-VSTeamWorkIte. Parameters:
    • Id Work item to be modified
    • RelationType: Values got from dynamic parameter
    • RelatedWorkItemId Related work item id
    • Operation Add|Remove|Replace
  • Add-VSTeamWorkItemLink Parameters:
    • Id workitem to be modified
    • RelationType: Values get from dynamic parameter
    • RelatedWorkItemId Related work item id
  • Get-VSTeamWorkItemLink Parameters
    • Id workitem to be modified
    • RelationType Optional. If not specified, return all relations in -Id
  • Remove-VSTeamWorkItemLink Parameters
    • Id workitem to be modified
    • RelatedWorkItemId Related work item id

All the above cmdlets will work internally with a JsonPatchDocument or compatible object. Also, below cmdlets will return this object/collection of objects respectively. Using this aproach, the -Relations paramter in the Update-VSTeamWorkItem can be built with the help of New-VSTeamWorkItemRelation or directly as the example at the very beginning of this thread.

  • New-VSTeamWorkItemRelation
  • Get-VSTeamWorkItemLink

PR Checklist

mnieto avatar May 29 '23 19:05 mnieto

I guess you are still in development, correct?

SebastianSchuetze avatar May 30 '23 09:05 SebastianSchuetze

I guess you are still in development, correct?

Yes, this is the first of multiple commits. Once it's ready I'll change the PR from draft

mnieto avatar May 30 '23 09:05 mnieto

Yes. I didn't see the draft part. 😎

SebastianSchuetze avatar May 30 '23 10:05 SebastianSchuetze

I will review it as soon as I can make time. Thank you for the contribution already!

SebastianSchuetze avatar Sep 19 '23 08:09 SebastianSchuetze

Merged Pull Request from Miguel Nieto the following:

  • Feat: added work ittems relationship management with the below new/modified CmdLets
    • Add-VSTeamWorkItemRelation: Adds a relationship between different workitems
    • Get-VSTeamWorkItemRelation: Retrieves a list of relations from a single work item
    • Get-VSTeamWorkItemRelationType: Returns a list of the different relation types between work items and links inside the same work item
    • New-VSTeamWorkItemRelation: Helper cmdlet that creates an in-memory Relation object to facilitate relationship management
    • Remove-VSTeamWorkItemRelation: Removes the relation from one or more workitems and one or more related workitems
    • Switch-VSTeamWorkItemParent: Replaces the parent of one or more work items
    • Update-VSTeamWorkItem: Added -Relations parameter

I removed this from the changelog. I exclusively changed to GH native way of doing a changelog. So CHANGELOG.md is not used anymore, but rather but into the squash message when merged to trunk.

SebastianSchuetze avatar Nov 05 '23 13:11 SebastianSchuetze

@SebastianSchuetze Do will finally merge this PR? Do you need some clarification or changes from my side before accepting the PR?

mnieto avatar Aug 05 '24 20:08 mnieto