Rename EndpointParams procedures to commands for CQRS clarity
Renamed Insert/Update/DeleteEndpointParamsProcedure classes and handlers to use the "Command" suffix (e.g., InsertEndpointParamsCommand) for consistency with CQRS conventions. Updated all controller actions, handlers, and tests to use the new command names. This improves clarity and aligns naming with standard command patterns.
This commit is contained in:
@@ -16,7 +16,7 @@ public class EndpointParamsController(IMediator mediator) : ControllerBase
|
||||
/// <returns>The created ENDPOINT_PARAMS identifier.</returns>
|
||||
[HttpPost]
|
||||
[ProducesResponseType(StatusCodes.Status201Created)]
|
||||
public async Task<IActionResult> Post([FromBody] InsertEndpointParamsProcedure procedure, CancellationToken cancel)
|
||||
public async Task<IActionResult> Post([FromBody] InsertEndpointParamsCommand procedure, CancellationToken cancel)
|
||||
{
|
||||
var id = await mediator.Send(procedure, cancel);
|
||||
return StatusCode(StatusCodes.Status201Created, id);
|
||||
@@ -30,7 +30,7 @@ public class EndpointParamsController(IMediator mediator) : ControllerBase
|
||||
/// <returns>No content on success.</returns>
|
||||
[HttpPut]
|
||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||
public async Task<IActionResult> Put([FromBody] UpdateEndpointParamsProcedure procedure, CancellationToken cancel)
|
||||
public async Task<IActionResult> Put([FromBody] UpdateEndpointParamsCommand procedure, CancellationToken cancel)
|
||||
{
|
||||
await mediator.Send(procedure, cancel);
|
||||
return NoContent();
|
||||
@@ -44,7 +44,7 @@ public class EndpointParamsController(IMediator mediator) : ControllerBase
|
||||
/// <returns>No content on success.</returns>
|
||||
[HttpDelete]
|
||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||
public async Task<IActionResult> Delete([FromBody] DeleteEndpointParamsProcedure procedure, CancellationToken cancel)
|
||||
public async Task<IActionResult> Delete([FromBody] DeleteEndpointParamsCommand procedure, CancellationToken cancel)
|
||||
{
|
||||
await mediator.Send(procedure, cancel);
|
||||
return NoContent();
|
||||
|
||||
@@ -29,7 +29,7 @@ public record InsertObjectProcedure : IRequest<long>
|
||||
public InsertEndpointAuthCommand EndpointAuth { get; set; } = new();
|
||||
public InsertProfileProcedure Profile { get; set; } = new();
|
||||
public InsertResultProcedure Result { get; set; } = new();
|
||||
public InsertEndpointParamsProcedure EndpointParams { get; set; } = new();
|
||||
public InsertEndpointParamsCommand EndpointParams { get; set; } = new();
|
||||
}
|
||||
|
||||
public class InsertObjectProcedureHandler(IRepository repo, IOptionsMonitor<SqlExceptionOptions> sqlExOpt) : IRequestHandler<InsertObjectProcedure, long>
|
||||
|
||||
@@ -3,7 +3,7 @@ using ReC.Application.Common.Procedures.DeleteProcedure;
|
||||
|
||||
namespace ReC.Application.EndpointParams.Commands;
|
||||
|
||||
public record DeleteEndpointParamsProcedure : IDeleteProcedure
|
||||
public record DeleteEndpointParamsCommand : IDeleteProcedure
|
||||
{
|
||||
/// <summary>
|
||||
/// Start GUID/ID (inclusive)
|
||||
@@ -21,9 +21,9 @@ public record DeleteEndpointParamsProcedure : IDeleteProcedure
|
||||
public bool Force { get; set; }
|
||||
}
|
||||
|
||||
public class DeleteEndpointParamsProcedureHandler(ISender sender) : IRequestHandler<DeleteEndpointParamsProcedure, int>
|
||||
public class DeleteEndpointParamsProcedureHandler(ISender sender) : IRequestHandler<DeleteEndpointParamsCommand, int>
|
||||
{
|
||||
public async Task<int> Handle(DeleteEndpointParamsProcedure request, CancellationToken cancel)
|
||||
public async Task<int> Handle(DeleteEndpointParamsCommand request, CancellationToken cancel)
|
||||
{
|
||||
return await sender.Send(new DeleteObjectProcedure
|
||||
{
|
||||
@@ -3,7 +3,7 @@ using ReC.Application.Common.Procedures.InsertProcedure;
|
||||
|
||||
namespace ReC.Application.EndpointParams.Commands;
|
||||
|
||||
public record InsertEndpointParamsProcedure : IInsertProcedure
|
||||
public record InsertEndpointParamsCommand : IInsertProcedure
|
||||
{
|
||||
public bool? Active { get; set; }
|
||||
public string? Description { get; set; }
|
||||
@@ -13,9 +13,9 @@ public record InsertEndpointParamsProcedure : IInsertProcedure
|
||||
public string? Value { get; set; }
|
||||
}
|
||||
|
||||
public class InsertEndpointParamsProcedureHandler(ISender sender) : IRequestHandler<InsertEndpointParamsProcedure, long>
|
||||
public class InsertEndpointParamsProcedureHandler(ISender sender) : IRequestHandler<InsertEndpointParamsCommand, long>
|
||||
{
|
||||
public async Task<long> Handle(InsertEndpointParamsProcedure request, CancellationToken cancel)
|
||||
public async Task<long> Handle(InsertEndpointParamsCommand request, CancellationToken cancel)
|
||||
{
|
||||
return await sender.Send(new InsertObjectProcedure
|
||||
{
|
||||
@@ -4,16 +4,16 @@ using ReC.Application.Common.Procedures.UpdateProcedure.Dto;
|
||||
|
||||
namespace ReC.Application.EndpointParams.Commands;
|
||||
|
||||
public record UpdateEndpointParamsProcedure : IUpdateProcedure<UpdateEndpointParamsDto>
|
||||
public record UpdateEndpointParamsCommand : IUpdateProcedure<UpdateEndpointParamsDto>
|
||||
{
|
||||
public long Id { get; set; }
|
||||
|
||||
public UpdateEndpointParamsDto Data { get; set; } = null!;
|
||||
}
|
||||
|
||||
public class UpdateEndpointParamsProcedureHandler(ISender sender) : IRequestHandler<UpdateEndpointParamsProcedure, int>
|
||||
public class UpdateEndpointParamsProcedureHandler(ISender sender) : IRequestHandler<UpdateEndpointParamsCommand, int>
|
||||
{
|
||||
public async Task<int> Handle(UpdateEndpointParamsProcedure request, CancellationToken cancel)
|
||||
public async Task<int> Handle(UpdateEndpointParamsCommand request, CancellationToken cancel)
|
||||
{
|
||||
return await sender.Send(new UpdateObjectProcedure
|
||||
{
|
||||
@@ -17,7 +17,7 @@ public class EndpointParamsProcedureTests : RecApplicationTestBase
|
||||
[Test]
|
||||
public async Task InsertEndpointParamsProcedure_runs_via_mediator()
|
||||
{
|
||||
var procedure = new InsertEndpointParamsProcedure { Active = true, Description = "param", GroupId = 1, Sequence = 1, Key = "k", Value = "v" };
|
||||
var procedure = new InsertEndpointParamsCommand { Active = true, Description = "param", GroupId = 1, Sequence = 1, Key = "k", Value = "v" };
|
||||
|
||||
var (sender, scope) = CreateScopedSender();
|
||||
using var _ = scope;
|
||||
@@ -29,7 +29,7 @@ public class EndpointParamsProcedureTests : RecApplicationTestBase
|
||||
[Test]
|
||||
public async Task UpdateEndpointParamsProcedure_runs_via_mediator()
|
||||
{
|
||||
var procedure = new UpdateEndpointParamsProcedure { Data = { Active = false, Description = "param-update", GroupId = 2, Sequence = 2, Key = "k2", Value = "v2" }, Id = 25 };
|
||||
var procedure = new UpdateEndpointParamsCommand { Data = { Active = false, Description = "param-update", GroupId = 2, Sequence = 2, Key = "k2", Value = "v2" }, Id = 25 };
|
||||
|
||||
var (sender, scope) = CreateScopedSender();
|
||||
using var _ = scope;
|
||||
@@ -41,7 +41,7 @@ public class EndpointParamsProcedureTests : RecApplicationTestBase
|
||||
[Test]
|
||||
public async Task DeleteEndpointParamsProcedure_runs_via_mediator()
|
||||
{
|
||||
var procedure = new DeleteEndpointParamsProcedure { Start = 5, End = 6, Force = true };
|
||||
var procedure = new DeleteEndpointParamsCommand { Start = 5, End = 6, Force = true };
|
||||
|
||||
var (sender, scope) = CreateScopedSender();
|
||||
using var _ = scope;
|
||||
|
||||
Reference in New Issue
Block a user