Rename *ActionProcedure classes to *ActionCommand
Renamed InsertActionProcedure, UpdateActionProcedure, and DeleteActionProcedure to their respective *ActionCommand counterparts to align with CQRS conventions. Updated all controller actions, handlers, tests, and related usages accordingly. No changes to business logic or method signatures.
This commit is contained in:
@@ -42,7 +42,7 @@ public class RecActionController(IMediator mediator) : ControllerBase
|
|||||||
/// <returns>An HTTP 201 Created response.</returns>
|
/// <returns>An HTTP 201 Created response.</returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ProducesResponseType(StatusCodes.Status201Created)]
|
[ProducesResponseType(StatusCodes.Status201Created)]
|
||||||
public async Task<IActionResult> Create([FromBody] InsertActionProcedure command, CancellationToken cancel)
|
public async Task<IActionResult> Create([FromBody] InsertActionCommand command, CancellationToken cancel)
|
||||||
{
|
{
|
||||||
await mediator.Send(command, cancel);
|
await mediator.Send(command, cancel);
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@ public class RecActionController(IMediator mediator) : ControllerBase
|
|||||||
/// <returns>No content on success.</returns>
|
/// <returns>No content on success.</returns>
|
||||||
[HttpPut("{id:long}")]
|
[HttpPut("{id:long}")]
|
||||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||||
public async Task<IActionResult> Update([FromBody] UpdateActionProcedure procedure, CancellationToken cancel)
|
public async Task<IActionResult> Update([FromBody] UpdateActionCommand procedure, CancellationToken cancel)
|
||||||
{
|
{
|
||||||
await mediator.Send(procedure, cancel);
|
await mediator.Send(procedure, cancel);
|
||||||
return NoContent();
|
return NoContent();
|
||||||
@@ -71,7 +71,7 @@ public class RecActionController(IMediator mediator) : ControllerBase
|
|||||||
/// <returns>An HTTP 204 No Content response upon successful deletion.</returns>
|
/// <returns>An HTTP 204 No Content response upon successful deletion.</returns>
|
||||||
[HttpDelete]
|
[HttpDelete]
|
||||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||||
public async Task<IActionResult> Delete([FromBody] DeleteActionProcedure procedure, CancellationToken cancel)
|
public async Task<IActionResult> Delete([FromBody] DeleteActionCommand procedure, CancellationToken cancel)
|
||||||
{
|
{
|
||||||
await mediator.Send(procedure, cancel);
|
await mediator.Send(procedure, cancel);
|
||||||
return NoContent();
|
return NoContent();
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public record InsertObjectProcedure : IRequest<long>
|
|||||||
//TODO: update to set in authentication middleware or similar, and remove from procedure properties
|
//TODO: update to set in authentication middleware or similar, and remove from procedure properties
|
||||||
internal string? AddedWho { get; private set; } = "ReC.API";
|
internal string? AddedWho { get; private set; } = "ReC.API";
|
||||||
|
|
||||||
public InsertActionProcedure Action { get; set; } = new();
|
public InsertActionCommand Action { get; set; } = new();
|
||||||
public InsertEndpointCommand Endpoint { get; set; } = new();
|
public InsertEndpointCommand Endpoint { get; set; } = new();
|
||||||
public InsertEndpointAuthCommand EndpointAuth { get; set; } = new();
|
public InsertEndpointAuthCommand EndpointAuth { get; set; } = new();
|
||||||
public InsertProfileCommand Profile { get; set; } = new();
|
public InsertProfileCommand Profile { get; set; } = new();
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ using ReC.Application.Common.Procedures.DeleteProcedure;
|
|||||||
|
|
||||||
namespace ReC.Application.RecActions.Commands;
|
namespace ReC.Application.RecActions.Commands;
|
||||||
|
|
||||||
public record DeleteActionProcedure : IDeleteProcedure
|
public record DeleteActionCommand : IDeleteProcedure
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Start GUID/ID (inclusive)
|
/// Start GUID/ID (inclusive)
|
||||||
@@ -21,9 +21,9 @@ public record DeleteActionProcedure : IDeleteProcedure
|
|||||||
public bool Force { get; set; }
|
public bool Force { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DeleteActionProcedureHandler(ISender sender) : IRequestHandler<DeleteActionProcedure, int>
|
public class DeleteActionProcedureHandler(ISender sender) : IRequestHandler<DeleteActionCommand, int>
|
||||||
{
|
{
|
||||||
public async Task<int> Handle(DeleteActionProcedure request, CancellationToken cancel)
|
public async Task<int> Handle(DeleteActionCommand request, CancellationToken cancel)
|
||||||
{
|
{
|
||||||
return await sender.Send(new DeleteObjectProcedure
|
return await sender.Send(new DeleteObjectProcedure
|
||||||
{
|
{
|
||||||
@@ -4,7 +4,7 @@ using ReC.Domain.Constants;
|
|||||||
|
|
||||||
namespace ReC.Application.RecActions.Commands;
|
namespace ReC.Application.RecActions.Commands;
|
||||||
|
|
||||||
public record InsertActionProcedure : IInsertProcedure
|
public record InsertActionCommand : IInsertProcedure
|
||||||
{
|
{
|
||||||
public long? ProfileId { get; set; }
|
public long? ProfileId { get; set; }
|
||||||
public bool? Active { get; set; }
|
public bool? Active { get; set; }
|
||||||
@@ -21,9 +21,9 @@ public record InsertActionProcedure : IInsertProcedure
|
|||||||
public byte? ErrorActionId { get; set; }
|
public byte? ErrorActionId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class InsertActionProcedureHandler(ISender sender) : IRequestHandler<InsertActionProcedure, long>
|
public class InsertActionProcedureHandler(ISender sender) : IRequestHandler<InsertActionCommand, long>
|
||||||
{
|
{
|
||||||
public async Task<long> Handle(InsertActionProcedure request, CancellationToken cancel)
|
public async Task<long> Handle(InsertActionCommand request, CancellationToken cancel)
|
||||||
{
|
{
|
||||||
return await sender.Send(new InsertObjectProcedure
|
return await sender.Send(new InsertObjectProcedure
|
||||||
{
|
{
|
||||||
@@ -4,16 +4,16 @@ using ReC.Application.Common.Procedures.UpdateProcedure.Dto;
|
|||||||
|
|
||||||
namespace ReC.Application.RecActions.Commands;
|
namespace ReC.Application.RecActions.Commands;
|
||||||
|
|
||||||
public record UpdateActionProcedure : IUpdateProcedure<UpdateActionDto>
|
public record UpdateActionCommand : IUpdateProcedure<UpdateActionDto>
|
||||||
{
|
{
|
||||||
public long Id { get; set; }
|
public long Id { get; set; }
|
||||||
|
|
||||||
public UpdateActionDto Data { get; set; } = null!;
|
public UpdateActionDto Data { get; set; } = null!;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UpdateActionProcedureHandler(ISender sender) : IRequestHandler<UpdateActionProcedure, int>
|
public class UpdateActionProcedureHandler(ISender sender) : IRequestHandler<UpdateActionCommand, int>
|
||||||
{
|
{
|
||||||
public async Task<int> Handle(UpdateActionProcedure request, CancellationToken cancel)
|
public async Task<int> Handle(UpdateActionCommand request, CancellationToken cancel)
|
||||||
{
|
{
|
||||||
return await sender.Send(new UpdateObjectProcedure
|
return await sender.Send(new UpdateObjectProcedure
|
||||||
{
|
{
|
||||||
@@ -25,7 +25,7 @@ public class RecActionProcedureTests : RecApplicationTestBase
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var procedure = new InsertActionProcedure { ProfileId = 1, Active = true, Sequence = 1, EndpointId = 1 };
|
var procedure = new InsertActionCommand { ProfileId = 1, Active = true, Sequence = 1, EndpointId = 1 };
|
||||||
|
|
||||||
var (sender, scope) = CreateScopedSender();
|
var (sender, scope) = CreateScopedSender();
|
||||||
using var _ = scope;
|
using var _ = scope;
|
||||||
@@ -53,7 +53,7 @@ public class RecActionProcedureTests : RecApplicationTestBase
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task UpdateActionProcedure_runs_via_mediator()
|
public async Task UpdateActionProcedure_runs_via_mediator()
|
||||||
{
|
{
|
||||||
var procedure = new UpdateActionProcedure { Data = { ProfileId = 2, Active = false, Sequence = 2 }, Id = 35 };
|
var procedure = new UpdateActionCommand { Data = { ProfileId = 2, Active = false, Sequence = 2 }, Id = 35 };
|
||||||
|
|
||||||
var (sender, scope) = CreateScopedSender();
|
var (sender, scope) = CreateScopedSender();
|
||||||
using var _ = scope;
|
using var _ = scope;
|
||||||
@@ -65,7 +65,7 @@ public class RecActionProcedureTests : RecApplicationTestBase
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task DeleteActionProcedure_runs_via_mediator()
|
public async Task DeleteActionProcedure_runs_via_mediator()
|
||||||
{
|
{
|
||||||
var procedure = new DeleteActionProcedure { Start = 7, End = 8, Force = true };
|
var procedure = new DeleteActionCommand { Start = 7, End = 8, Force = true };
|
||||||
|
|
||||||
var (sender, scope) = CreateScopedSender();
|
var (sender, scope) = CreateScopedSender();
|
||||||
using var _ = scope;
|
using var _ = scope;
|
||||||
|
|||||||
Reference in New Issue
Block a user