-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: resolve miscellaneous issues in
Timelines
module
- Loading branch information
1 parent
d607c9b
commit 91eaa6f
Showing
5 changed files
with
38 additions
and
35 deletions.
There are no files selected for viewing
25 changes: 14 additions & 11 deletions
25
Backend/src/Modules/Timelines/Timelines.Api/Endpoints/Timelines/CreateTimeline.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,31 @@ | ||
using BuildingBlocks.Domain.ValueObjects.Ids; | ||
using Timelines.Application.Entities.Timelines.Commands.CreateTimeline; | ||
|
||
// ReSharper disable ClassNeverInstantiated.Global | ||
|
||
namespace Timelines.Api.Endpoints.Timelines; | ||
|
||
public class CreateTimeline : ICarterModule | ||
{ | ||
public void AddRoutes(IEndpointRouteBuilder app) | ||
{ | ||
app.MapPost("/Timelines", async (CreateTimelineRequest request, ISender sender) => | ||
{ | ||
var command = request.Adapt<CreateTimelineCommand>(); | ||
var result = await sender.Send(command); | ||
var response = result.Adapt<CreateTimelineResponse>(); | ||
{ | ||
var command = request.Adapt<CreateTimelineCommand>(); | ||
var result = await sender.Send(command); | ||
var response = result.Adapt<CreateTimelineResponse>(); | ||
|
||
return Results.Created($"/Timelines/{response.Id}", response); | ||
}) | ||
.WithName("CreateTimeline") | ||
.Produces<CreateTimelineResponse>(StatusCodes.Status201Created) | ||
.ProducesProblem(StatusCodes.Status400BadRequest) | ||
.WithSummary("Create Timeline") | ||
.WithDescription("Creates a new timeline"); | ||
return Results.Created($"/Timelines/{response.Id}", response); | ||
}) | ||
.WithName("CreateTimeline") | ||
.Produces<CreateTimelineResponse>(StatusCodes.Status201Created) | ||
.ProducesProblem(StatusCodes.Status400BadRequest) | ||
.WithSummary("Create Timeline") | ||
.WithDescription("Creates a new timeline"); | ||
} | ||
} | ||
|
||
// ReSharper disable once NotAccessedPositionalProperty.Global | ||
public record CreateTimelineRequest(TimelineDto Timeline); | ||
|
||
public record CreateTimelineResponse(TimelineId Id); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
...Timelines.Application/Entities/Timelines/Commands/CreateTimeline/CreateTimelineHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters