向宁 9f878286e7 feat: form versioning, notification center, scheduler and webhooks
- Add FormDefinitionVersion with compare/versions endpoints and schema differ
- Add Notification entity, endpoints and application features
- Add Scheduler (timeout) and WebhookDispatcher services
- Add FormDataValidator/FieldPermissionEvaluator/ReactionEvaluator
- Add workflow task mark-read, CC support and SystemUserContext
- Add EF migrations for form versions and notifications
- Add unit tests for form schema, notifications, scheduler and serialization
2026-06-14 15:03:11 +08:00

41 lines
1.2 KiB
C#

using FastEndpoints;
using MediatR;
using Workflow.Application.Features.WorkflowDefinitions.Commands;
using Workflow.Application.Features.WorkflowDefinitions.DTOs;
using Workflow.Domain.Enums;
namespace Workflow.Api.Endpoints.WorkflowDefinition;
public class UpdateEdgeEndpoint : Endpoint<UpdateEdgeRequest, WorkflowEdgeDto>
{
private readonly IMediator _mediator;
public UpdateEdgeEndpoint(IMediator mediator) => _mediator = mediator;
public override void Configure()
{
Put("/workflow-definitions/{DefinitionId}/edges/{EdgeId}");
Summary(s =>
{
s.Summary = "Update an edge in a workflow definition";
});
}
public override async Task HandleAsync(UpdateEdgeRequest req, CancellationToken ct)
{
var command = new UpdateEdgeCommand(req.EdgeId, (EdgeType)req.EdgeType, req.Label, req.Condition, req.Order);
var result = await _mediator.Send(command, ct);
await Send.OkAsync(result, ct);
}
}
public class UpdateEdgeRequest
{
public Guid DefinitionId { get; set; }
public Guid EdgeId { get; set; }
public int EdgeType { get; set; }
public string? Label { get; set; }
public string? Condition { get; set; }
public int Order { get; set; }
}