Skip to content

feat(project-item): add reset functionality for staged values - #162

Merged
rulasg merged 11 commits into
mainfrom
reset-projectitem
Oct 18, 2025
Merged

feat(project-item): add reset functionality for staged values#162
rulasg merged 11 commits into
mainfrom
reset-projectitem

Conversation

@rulasg

@rulasg rulasg commented Oct 17, 2025

Copy link
Copy Markdown
Owner

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.


# Act - reset F1
Reset-ProjectItem -Owner $owner -ProjectNumber $projectNumber -ItemId $itemId -FieldName $f1

Check notice

Code scanning / PSScriptAnalyzer

Line has trailing whitespace Note

Line has trailing whitespace
$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

Line has trailing whitespace
Assert-AreEqual -Expected $f2Value -Presented $reset1.$f2

# Act Reset F2

Check notice

Code scanning / PSScriptAnalyzer

Line has trailing whitespace Note

Line has trailing whitespace

# Act - reset F1
Reset-ProjectItem -Owner $owner -ProjectNumber $projectNumber -ItemId $itemId

Check notice

Code scanning / PSScriptAnalyzer

Line has trailing whitespace Note

Line has trailing whitespace
# Remove value
$db.Staged.$ItemId.Remove($FieldId)
}

Check notice

Code scanning / PSScriptAnalyzer

Line has trailing whitespace Note

Line has trailing whitespace

} Export-ModuleMember -Function Edit-ProjectItem

function Reset-ProjectItem {

Check notice

Code scanning / PSScriptAnalyzer

The cmdlet 'Reset-ProjectItem' does not have a help comment. Note

The cmdlet 'Reset-ProjectItem' does not have a help comment.

} 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

Function 'Reset-ProjectItem' has verb that could change system state. Therefore, the function has to support 'ShouldProcess'.

($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

Line has trailing whitespace
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

Function 'Remove-ItemValueStaged' has verb that could change system state. Therefore, the function has to support 'ShouldProcess'.
$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

The cmdlet 'Remove-ProjectItemDirect' returns an object of type 'System.String' but this type is not declared in the OutputType attribute.
# Fake execution return ItemId
return $ItemId
}

Check notice

Code scanning / PSScriptAnalyzer

Line has trailing whitespace Note

Line has trailing whitespace
return $null
}
}

Check notice

Code scanning / PSScriptAnalyzer

Line has trailing whitespace Note

Line has trailing whitespace

$ret = $response.data.deleteProjectV2Item.deletedItemId


Check notice

Code scanning / PSScriptAnalyzer

Line has trailing whitespace Note

Line has trailing whitespace
@rulasg
rulasg merged commit 12c580c into main Oct 18, 2025
3 checks passed
@rulasg
rulasg deleted the reset-projectitem branch October 18, 2025 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants