From e74ee56f42106f3a4a7dd916e363eb32e6893d26 Mon Sep 17 00:00:00 2001 From: TekH Date: Mon, 1 Dec 2025 16:19:51 +0100 Subject: [PATCH] Add DeleteRecActionsCommand and handler for deletion Introduced `DeleteRecActionsCommand` and its handler to enable deletion of `RecAction` entities based on `ProfileId`. Added necessary `using` directives and organized the code under the `ReC.Application.RecActions.Commands` namespace. The handler uses dependency injection for the repository and performs asynchronous deletion with cancellation support. --- .../Commands/DeleteRecActionsCommand.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/ReC.Application/RecActions/Commands/DeleteRecActionsCommand.cs diff --git a/src/ReC.Application/RecActions/Commands/DeleteRecActionsCommand.cs b/src/ReC.Application/RecActions/Commands/DeleteRecActionsCommand.cs new file mode 100644 index 0000000..c1d0402 --- /dev/null +++ b/src/ReC.Application/RecActions/Commands/DeleteRecActionsCommand.cs @@ -0,0 +1,18 @@ +using DigitalData.Core.Abstraction.Application.Repository; +using MediatR; +using ReC.Domain.Entities; + +namespace ReC.Application.RecActions.Commands; + +public class DeleteRecActionsCommand : IRequest +{ + public long ProfileId { get; init; } = 2; +} + +public class DeleteRecActionsCommandHandler(IRepository repo) : IRequestHandler +{ + public async Task Handle(DeleteRecActionsCommand request, CancellationToken cancel) + { + await repo.DeleteAsync(act => act.ProfileId == request.ProfileId, cancel); + } +} \ No newline at end of file