mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
feat(dir): ✨ point list create endpoint ressult to changes by id endpoint
This commit is contained in:
parent
fec59aaf6d
commit
3eca3ddf9c
3 changed files with 13 additions and 4 deletions
|
|
@ -34,10 +34,14 @@ public Task<IActionResult> Get(CancellationToken cancellationToken)
|
|||
/// <param name="command">The command.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
[HttpPost]
|
||||
[ProducesResponseType(typeof(CreateList.Response), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(typeof(CreateList.Response), StatusCodes.Status202Accepted)]
|
||||
public async Task<IActionResult> Create(CreateList.Command command, CancellationToken cancellationToken)
|
||||
{
|
||||
return Ok(await _mediator.Send(command, cancellationToken));
|
||||
var response = await _mediator.Send(command, cancellationToken);
|
||||
return AcceptedAtAction(
|
||||
nameof(ChangesController.GetDetails),
|
||||
nameof(ChangesController).Replace("Controller", string.Empty),
|
||||
new { id = response.ChangeId });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -26,5 +26,10 @@
|
|||
app.UseProblemDetails();
|
||||
app.UseSwagger();
|
||||
app.MapControllers();
|
||||
app.Use(async (context, next) =>
|
||||
{
|
||||
context.Request.PathBase = "/api/directory";
|
||||
await next.Invoke();
|
||||
});
|
||||
|
||||
await app.TryRunWithLoggingAsync(() => app.MigrateAsync());
|
||||
|
|
|
|||
|
|
@ -76,9 +76,9 @@ public async Task<Response> Handle(Command request, CancellationToken cancellati
|
|||
|
||||
await _commandContext.SaveChangesAsync(cancellationToken);
|
||||
|
||||
return new Response();
|
||||
return new Response(filterList.Changes.Single().Id);
|
||||
}
|
||||
}
|
||||
|
||||
public record Response { }
|
||||
public record Response(long ChangeId) { }
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue