work-flow/src/Workflow.Api/Endpoints/WorkflowInstance/WithdrawWorkflowInstanceEndpoint.cs
向宁 fc4ecbbacc feat: add gRPC auth, condition comparators, seed data, EF migrations
- gRPC auth service for token validation
- Value comparator system (string, numeric, boolean, datetime, collection)
- Condition evaluator with strategy chain
- Form definition and data improvements
- Workflow instance/task endpoints updated
- Seed data and EF design-time factory
- Test coverage for comparators and handlers
2026-05-20 20:28:35 +08:00

36 lines
1011 B
C#

using FastEndpoints;
using MediatR;
using Workflow.Application.Features.WorkflowInstances.Commands;
namespace Workflow.Api.Endpoints.WorkflowInstance;
public class WithdrawWorkflowInstanceEndpoint : Endpoint<WithdrawWorkflowInstanceRequest>
{
private readonly IMediator _mediator;
public WithdrawWorkflowInstanceEndpoint(IMediator mediator) => _mediator = mediator;
public override void Configure()
{
Post("/workflow-instances/{Id}/withdraw");
AllowAnonymous();
Summary(s =>
{
s.Summary = "Withdraw a workflow instance (initiator only)";
});
}
public override async Task HandleAsync(WithdrawWorkflowInstanceRequest req, CancellationToken ct)
{
var command = new WithdrawWorkflowInstanceCommand(req.Id, req.UserId);
await _mediator.Send(command, ct);
await Send.OkAsync(ct);
}
}
public class WithdrawWorkflowInstanceRequest
{
public Guid Id { get; set; }
public Guid UserId { get; set; }
}