Files
ReC/src/ReC.Application/Profile/Commands/DeleteProfileCommand.cs
TekH 6681e56afc Refactor entity selection to use EntityType enum
Replaced string-based entity identifiers in CRUD procedure and command classes with a strongly-typed EntityType enum. Updated all relevant handlers and records to use the new enum property, improving type safety and maintainability. Added necessary using directives and updated documentation comments to reflect these changes.
2026-04-16 17:14:29 +02:00

37 lines
1.0 KiB
C#

using MediatR;
using ReC.Application.Common.Procedures.DeleteProcedure;
using ReC.Application.Common.Procedures;
namespace ReC.Application.Profile.Commands;
public record DeleteProfileCommand : 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 DeleteProfileProcedureHandler(ISender sender) : IRequestHandler<DeleteProfileCommand, int>
{
public async Task<int> Handle(DeleteProfileCommand request, CancellationToken cancel)
{
return await sender.Send(new DeleteObjectProcedure
{
Entity = EntityType.Profile,
Start = request.Start,
End = request.End,
Force = request.Force
}, cancel);
}
}