Refactor endpoint Procedures to Commands for CQRS alignment
Renamed Insert/Update/DeleteEndpointProcedure classes to their respective Command counterparts to follow CQRS conventions. Updated controller actions, handlers, InsertObjectProcedure, and related unit tests to use the new Command types. No functional changes were made; this is a naming refactor.
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
using MediatR;
|
||||
using ReC.Application.Common.Procedures.DeleteProcedure;
|
||||
|
||||
namespace ReC.Application.Endpoints.Commands;
|
||||
|
||||
public record DeleteEndpointCommand : IDeleteProcedure
|
||||
{
|
||||
/// <summary>
|
||||
/// Start GUID/ID (inclusive)
|
||||
/// </summary>
|
||||
public long Start { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// End GUID/ID (inclusive). If 0, will be set to Start value.
|
||||
/// </summary>
|
||||
public long End { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If true, delete even if dependent ACTION data exists
|
||||
/// </summary>
|
||||
public bool Force { get; set; }
|
||||
}
|
||||
|
||||
public class DeleteEndpointProcedureHandler(ISender sender) : IRequestHandler<DeleteEndpointCommand, int>
|
||||
{
|
||||
public async Task<int> Handle(DeleteEndpointCommand request, CancellationToken cancel)
|
||||
{
|
||||
return await sender.Send(new DeleteObjectProcedure
|
||||
{
|
||||
Entity = "ENDPOINT",
|
||||
Start = request.Start,
|
||||
End = request.End,
|
||||
Force = request.Force
|
||||
}, cancel);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user