diff --git a/services/Directory/FilterLists.Directory.Api/Controllers/ListsController.cs b/services/Directory/FilterLists.Directory.Api/Controllers/ListsController.cs index dd5a43845..0b051b456 100644 --- a/services/Directory/FilterLists.Directory.Api/Controllers/ListsController.cs +++ b/services/Directory/FilterLists.Directory.Api/Controllers/ListsController.cs @@ -34,10 +34,14 @@ public Task Get(CancellationToken cancellationToken) /// The command. /// The cancellation token. [HttpPost] - [ProducesResponseType(typeof(CreateList.Response), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(CreateList.Response), StatusCodes.Status202Accepted)] public async Task 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 }); } /// diff --git a/services/Directory/FilterLists.Directory.Api/Program.cs b/services/Directory/FilterLists.Directory.Api/Program.cs index 398c5ea67..8fec9f877 100644 --- a/services/Directory/FilterLists.Directory.Api/Program.cs +++ b/services/Directory/FilterLists.Directory.Api/Program.cs @@ -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()); diff --git a/services/Directory/FilterLists.Directory.Application/Commands/CreateList.cs b/services/Directory/FilterLists.Directory.Application/Commands/CreateList.cs index 012ee7bc4..91d24edd7 100644 --- a/services/Directory/FilterLists.Directory.Application/Commands/CreateList.cs +++ b/services/Directory/FilterLists.Directory.Application/Commands/CreateList.cs @@ -76,9 +76,9 @@ public async Task 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) { } }