diff --git a/Backend/src/Modules/Timelines/Timelines.Api/Endpoints/Timelines/CreateTimeline.cs b/Backend/src/Modules/Timelines/Timelines.Api/Endpoints/Timelines/CreateTimeline.cs index 30a9088..a4fe6f0 100644 --- a/Backend/src/Modules/Timelines/Timelines.Api/Endpoints/Timelines/CreateTimeline.cs +++ b/Backend/src/Modules/Timelines/Timelines.Api/Endpoints/Timelines/CreateTimeline.cs @@ -1,6 +1,8 @@ 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 @@ -8,21 +10,22 @@ public class CreateTimeline : ICarterModule public void AddRoutes(IEndpointRouteBuilder app) { app.MapPost("/Timelines", async (CreateTimelineRequest request, ISender sender) => - { - var command = request.Adapt(); - var result = await sender.Send(command); - var response = result.Adapt(); + { + var command = request.Adapt(); + var result = await sender.Send(command); + var response = result.Adapt(); - return Results.Created($"/Timelines/{response.Id}", response); - }) - .WithName("CreateTimeline") - .Produces(StatusCodes.Status201Created) - .ProducesProblem(StatusCodes.Status400BadRequest) - .WithSummary("Create Timeline") - .WithDescription("Creates a new timeline"); + return Results.Created($"/Timelines/{response.Id}", response); + }) + .WithName("CreateTimeline") + .Produces(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); diff --git a/Backend/src/Modules/Timelines/Timelines.Api/Endpoints/Timelines/GetTimelineById.cs b/Backend/src/Modules/Timelines/Timelines.Api/Endpoints/Timelines/GetTimelineById.cs index cc0c995..0eb6e90 100644 --- a/Backend/src/Modules/Timelines/Timelines.Api/Endpoints/Timelines/GetTimelineById.cs +++ b/Backend/src/Modules/Timelines/Timelines.Api/Endpoints/Timelines/GetTimelineById.cs @@ -9,22 +9,21 @@ public class GetTimelineById : ICarterModule public void AddRoutes(IEndpointRouteBuilder app) { app.MapGet("/Timelines/{timelineId}", async (string timelineId, ISender sender) => - { - var result = await sender.Send(new GetTimelineByIdQuery(timelineId)); - var response = result.Adapt(); + { + var result = await sender.Send(new GetTimelineByIdQuery(timelineId)); + var response = result.Adapt(); - return Results.Ok(response); - }) - .WithName("GetTimelineById") - .Produces() - .ProducesProblem(StatusCodes.Status400BadRequest) - .ProducesProblem(StatusCodes.Status404NotFound) - .WithSummary("Get Timeline by Id") - .WithDescription("Get Timeline by Id"); + return Results.Ok(response); + }) + .WithName("GetTimelineById") + .Produces() + .ProducesProblem(StatusCodes.Status400BadRequest) + .ProducesProblem(StatusCodes.Status404NotFound) + .WithSummary("Get Timeline by Id") + .WithDescription("Get Timeline by Id"); } } - // ReSharper disable once ClassNeverInstantiated.Global // ReSharper disable once NotAccessedPositionalProperty.Global public record GetTimelineByIdResponse([property: JsonPropertyName("timeline")] TimelineDto TimelineDto); diff --git a/Backend/src/Modules/Timelines/Timelines.Api/Endpoints/Timelines/ListTimelines.cs b/Backend/src/Modules/Timelines/Timelines.Api/Endpoints/Timelines/ListTimelines.cs index 89735fd..435b91a 100644 --- a/Backend/src/Modules/Timelines/Timelines.Api/Endpoints/Timelines/ListTimelines.cs +++ b/Backend/src/Modules/Timelines/Timelines.Api/Endpoints/Timelines/ListTimelines.cs @@ -8,17 +8,17 @@ public class ListTimelines : ICarterModule public void AddRoutes(IEndpointRouteBuilder app) { app.MapGet("/Timelines", async ([AsParameters] PaginationRequest query, ISender sender) => - { - var result = await sender.Send(new ListTimelinesQuery(query)); - var response = result.Adapt(); + { + var result = await sender.Send(new ListTimelinesQuery(query)); + var response = result.Adapt(); - return Results.Ok(response); - }) - .WithName("ListTimelines") - .Produces() - .ProducesProblem(StatusCodes.Status400BadRequest) - .WithSummary("List Timelines") - .WithDescription("List Timelines"); + return Results.Ok(response); + }) + .WithName("ListTimelines") + .Produces() + .ProducesProblem(StatusCodes.Status400BadRequest) + .WithSummary("List Timelines") + .WithDescription("List Timelines"); } } diff --git a/Backend/src/Modules/Timelines/Timelines.Application/Entities/Timelines/Commands/CreateTimeline/CreateTimelineCommand.cs b/Backend/src/Modules/Timelines/Timelines.Application/Entities/Timelines/Commands/CreateTimeline/CreateTimelineCommand.cs index 8cffdf8..7444435 100644 --- a/Backend/src/Modules/Timelines/Timelines.Application/Entities/Timelines/Commands/CreateTimeline/CreateTimelineCommand.cs +++ b/Backend/src/Modules/Timelines/Timelines.Application/Entities/Timelines/Commands/CreateTimeline/CreateTimelineCommand.cs @@ -2,8 +2,10 @@ namespace Timelines.Application.Entities.Timelines.Commands.CreateTimeline; +// ReSharper disable once ClassNeverInstantiated.Global public record CreateTimelineCommand(TimelineDto Timeline) : ICommand; +// ReSharper disable once NotAccessedPositionalProperty.Global public record CreateTimelineResult(TimelineId Id); public class CreateTimelineCommandValidator : AbstractValidator diff --git a/Backend/src/Modules/Timelines/Timelines.Application/Entities/Timelines/Commands/CreateTimeline/CreateTimelineHandler.cs b/Backend/src/Modules/Timelines/Timelines.Application/Entities/Timelines/Commands/CreateTimeline/CreateTimelineHandler.cs index f3c1efd..3df7761 100644 --- a/Backend/src/Modules/Timelines/Timelines.Application/Entities/Timelines/Commands/CreateTimeline/CreateTimelineHandler.cs +++ b/Backend/src/Modules/Timelines/Timelines.Application/Entities/Timelines/Commands/CreateTimeline/CreateTimelineHandler.cs @@ -1,7 +1,6 @@ namespace Timelines.Application.Entities.Timelines.Commands.CreateTimeline; -public class CreateTimelineHandler(ITimelinesDbContext dbContext) : - ICommandHandler +internal class CreateTimelineHandler(ITimelinesDbContext dbContext) : ICommandHandler { public async Task Handle(CreateTimelineCommand command, CancellationToken cancellationToken) {