Refactor RecActionView command invocation, remove extension

Removed the ToInvokeCommand extension method and now construct InvokeRecActionViewCommand instances directly in the batch handler. Also added an unused using directive in InvokeBatchRecActionViewsCommand.cs.
This commit is contained in:
2026-03-02 13:11:50 +01:00
parent 23246d4ebf
commit 0a3761921d
2 changed files with 3 additions and 7 deletions

View File

@@ -1,4 +1,5 @@
using MediatR; using DigitalData.Core.Abstractions.Interfaces;
using MediatR;
using ReC.Application.RecActions.Queries; using ReC.Application.RecActions.Queries;
using ReC.Domain.Constants; using ReC.Domain.Constants;
@@ -23,7 +24,7 @@ public class InvokeRecActionViewsCommandHandler(ISender sender) : IRequestHandle
foreach (var action in actions) foreach (var action in actions)
{ {
var ok = await sender.Send(action.ToInvokeCommand(), cancel); var ok = await sender.Send(new InvokeRecActionViewCommand() { Action = action }, cancel);
if (!ok) if (!ok)
switch (action.ErrorAction) switch (action.ErrorAction)
{ {

View File

@@ -19,11 +19,6 @@ public record InvokeRecActionViewCommand : IRequest<bool>
public RecActionViewDto Action { get; set; } = null!; public RecActionViewDto Action { get; set; } = null!;
} }
public static class InvokeRecActionViewCommandExtensions
{
public static InvokeRecActionViewCommand ToInvokeCommand(this RecActionViewDto dto) => new() { Action = dto };
}
public class InvokeRecActionViewCommandHandler( public class InvokeRecActionViewCommandHandler(
ISender sender, ISender sender,
IHttpClientFactory clientFactory, IHttpClientFactory clientFactory,