36 lines
949 B
C#
36 lines
949 B
C#
using FastEndpoints;
|
|
using MediatR;
|
|
using Workflow.Application.Features.WorkflowDefinitions.Commands;
|
|
|
|
namespace Workflow.Api.Endpoints.WorkflowDefinition;
|
|
|
|
public class DeleteEdgeEndpoint : Endpoint<DeleteEdgeRequest>
|
|
{
|
|
private readonly IMediator _mediator;
|
|
|
|
public DeleteEdgeEndpoint(IMediator mediator) => _mediator = mediator;
|
|
|
|
public override void Configure()
|
|
{
|
|
Delete("/workflow-definitions/{DefinitionId}/edges/{EdgeId}");
|
|
AllowAnonymous();
|
|
Summary(s =>
|
|
{
|
|
s.Summary = "Delete an edge from a workflow definition";
|
|
});
|
|
}
|
|
|
|
public override async Task HandleAsync(DeleteEdgeRequest req, CancellationToken ct)
|
|
{
|
|
var command = new DeleteEdgeCommand(req.EdgeId);
|
|
await _mediator.Send(command, ct);
|
|
await Send.OkAsync(ct);
|
|
}
|
|
}
|
|
|
|
public class DeleteEdgeRequest
|
|
{
|
|
public Guid DefinitionId { get; set; }
|
|
public Guid EdgeId { get; set; }
|
|
}
|