merge: make add_task optional params actually optional

This commit is contained in:
Mika Kuns
2026-06-01 15:29:29 +02:00

View File

@@ -90,17 +90,15 @@ public sealed class ExternalMcpService
public async Task<TaskDto> AddTask(
string listId,
string title,
string? description,
string createdBy,
bool queueImmediately,
CancellationToken cancellationToken)
string? description = null,
string? createdBy = null,
bool queueImmediately = false,
CancellationToken cancellationToken = default)
{
if (string.IsNullOrWhiteSpace(listId))
throw new InvalidOperationException("listId is required.");
if (string.IsNullOrWhiteSpace(title))
throw new InvalidOperationException("title is required.");
if (string.IsNullOrWhiteSpace(createdBy))
throw new InvalidOperationException("createdBy is required.");
var list = await _lists.GetByIdAsync(listId, cancellationToken)
?? throw new InvalidOperationException($"List {listId} not found.");
@@ -114,7 +112,7 @@ public sealed class ExternalMcpService
Status = TaskStatus.Idle,
CreatedAt = DateTime.UtcNow,
CommitType = list.DefaultCommitType,
CreatedBy = createdBy,
CreatedBy = createdBy.NullIfBlank() ?? "mcp",
};
await _tasks.AddAsync(entity, cancellationToken);