feat(project-item): add reset functionality for staged values - #162
Conversation
|
|
||
| # Act - reset F1 | ||
| Reset-ProjectItem -Owner $owner -ProjectNumber $projectNumber -ItemId $itemId -FieldName $f1 | ||
|
|
Check notice
Code scanning / PSScriptAnalyzer
Line has trailing whitespace Note
| $reset1 = Get-ProjectItem $itemId | ||
| Assert-AreEqual -Expected $f1Actual -Presented $reset1.$f1 | ||
| Assert-AreEqual -Expected $f2Value -Presented $reset1.$f2 | ||
|
|
Check notice
Code scanning / PSScriptAnalyzer
Line has trailing whitespace Note
| Assert-AreEqual -Expected $f2Value -Presented $reset1.$f2 | ||
|
|
||
| # Act Reset F2 | ||
|
|
Check notice
Code scanning / PSScriptAnalyzer
Line has trailing whitespace Note
|
|
||
| # Act - reset F1 | ||
| Reset-ProjectItem -Owner $owner -ProjectNumber $projectNumber -ItemId $itemId | ||
|
|
Check notice
Code scanning / PSScriptAnalyzer
Line has trailing whitespace Note
| # Remove value | ||
| $db.Staged.$ItemId.Remove($FieldId) | ||
| } | ||
|
|
Check notice
Code scanning / PSScriptAnalyzer
Line has trailing whitespace Note
|
|
||
| } Export-ModuleMember -Function Edit-ProjectItem | ||
|
|
||
| function Reset-ProjectItem { |
Check notice
Code scanning / PSScriptAnalyzer
The cmdlet 'Reset-ProjectItem' does not have a help comment. Note
|
|
||
| } Export-ModuleMember -Function Edit-ProjectItem | ||
|
|
||
| function Reset-ProjectItem { |
Check warning
Code scanning / PSScriptAnalyzer
Function 'Reset-ProjectItem' has verb that could change system state. Therefore, the function has to support 'ShouldProcess'. Warning
|
|
||
| ($Owner, $ProjectNumber) = Get-OwnerAndProjectNumber -Owner $Owner -ProjectNumber $ProjectNumber | ||
| if ([string]::IsNullOrWhiteSpace($owner) -or [string]::IsNullOrWhiteSpace($ProjectNumber)) { "Owner and ProjectNumber are required" | Write-MyError; return $null } | ||
|
|
Check notice
Code scanning / PSScriptAnalyzer
Line has trailing whitespace Note
… parameter name for clarity
…ged for consistency
| return | ||
| } | ||
|
|
||
| function Remove-ItemValueStaged{ |
Check warning
Code scanning / PSScriptAnalyzer
Function 'Remove-ItemValueStaged' has verb that could change system state. Therefore, the function has to support 'ShouldProcess'. Warning
| $response = Invoke-MyCommand -Command RemoveItemFromProject -Parameters @{ projectid = $projectId ; itemid = $ItemId } | ||
| } else { | ||
| # Fake execution return ItemId | ||
| return $ItemId |
Check notice
Code scanning / PSScriptAnalyzer
The cmdlet 'Remove-ProjectItemDirect' returns an object of type 'System.String' but this type is not declared in the OutputType attribute. Note
| # Fake execution return ItemId | ||
| return $ItemId | ||
| } | ||
|
|
Check notice
Code scanning / PSScriptAnalyzer
Line has trailing whitespace Note
| return $null | ||
| } | ||
| } | ||
|
|
Check notice
Code scanning / PSScriptAnalyzer
Line has trailing whitespace Note
|
|
||
| $ret = $response.data.deleteProjectV2Item.deletedItemId | ||
|
|
||
|
|
Check notice
Code scanning / PSScriptAnalyzer
Line has trailing whitespace Note
Introduce a new function to reset staged values for project items, ensuring correct handling of both individual fields and entire items. Fixes parameter passing in the Show-ProjectItem function for improved reliability.