Skip to content

Commit 5a999d0

Browse files
cedricedri
authored andcommitted
Add Cancellation token
1 parent bdb1dcd commit 5a999d0

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

StructuredMinimalApi/Application/Todos/Commands/CreateTodo/CreateTodoEndpoint.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,22 @@ namespace StructuredMinimalApi.Application.Todos.Commands.CreateTodo
66
/// <summary>
77
/// Endpoint to create a todo
88
/// </summary>
9-
public class CreateTodoEndpoint : IEndpoint<IResult, CreateTodoCommand>
9+
public class CreateTodoEndpoint : IEndpoint<IResult, CreateTodoCommand, CancellationToken>
1010
{
1111
public void AddRoute(IEndpointRouteBuilder app)
1212
{
13-
app.MapPost("/Todo", (CreateTodoCommand command) => HandleAsync(command))
13+
app.MapPost("/Todo", (CreateTodoCommand command, CancellationToken cancellationToken)
14+
=> HandleAsync(command, cancellationToken))
1415
.Produces<Message>(StatusCodes.Status201Created);
1516
}
1617

1718
/// <summary>
1819
/// Endpoint to create a todo
1920
/// </summary>
2021
/// <param name="command"></param>
22+
/// <param name="cancellationToken"></param>
2123
/// <returns></returns>
22-
public Task<IResult> HandleAsync(CreateTodoCommand command)
24+
public Task<IResult> HandleAsync(CreateTodoCommand command, CancellationToken cancellationToken)
2325
{
2426
var message = new Message
2527
{

0 commit comments

Comments
 (0)