Files
Teamup/src/Modules/TeamUp.Modules.Governance/Gate/HeldActionExecutor.cs
T

31 lines
1.0 KiB
C#
Raw Normal View History

using TeamUp.SharedKernel.Board;
namespace TeamUp.Modules.Governance.Gate;
/// <summary>
/// Performs the internal action behind an agent proposal: write the artifact onto the task and
/// create the proposed child tasks. Used by the gate (autonomous path) and the approve endpoint.
/// </summary>
internal sealed class HeldActionExecutor(IBoardWriter boardWriter)
{
public async Task ExecuteAsync(
Guid teamId,
Guid workItemId,
string content,
IReadOnlyList<string> childTitles,
Guid? actedByMemberId,
CancellationToken cancellationToken = default)
{
if (!string.IsNullOrWhiteSpace(content))
{
await boardWriter.AttachArtifactAsync(workItemId, content, cancellationToken);
}
if (childTitles.Count > 0)
{
var children = childTitles.Select(title => new ChildTaskSpec(title, "Story")).ToList();
await boardWriter.CreateChildTasksAsync(teamId, workItemId, children, actedByMemberId, cancellationToken);
}
}
}