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:
@@ -1,4 +1,5 @@
|
||||
using MediatR;
|
||||
using DigitalData.Core.Abstractions.Interfaces;
|
||||
using MediatR;
|
||||
using ReC.Application.RecActions.Queries;
|
||||
using ReC.Domain.Constants;
|
||||
|
||||
@@ -23,7 +24,7 @@ public class InvokeRecActionViewsCommandHandler(ISender sender) : IRequestHandle
|
||||
|
||||
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)
|
||||
switch (action.ErrorAction)
|
||||
{
|
||||
|
||||
@@ -19,11 +19,6 @@ public record InvokeRecActionViewCommand : IRequest<bool>
|
||||
public RecActionViewDto Action { get; set; } = null!;
|
||||
}
|
||||
|
||||
public static class InvokeRecActionViewCommandExtensions
|
||||
{
|
||||
public static InvokeRecActionViewCommand ToInvokeCommand(this RecActionViewDto dto) => new() { Action = dto };
|
||||
}
|
||||
|
||||
public class InvokeRecActionViewCommandHandler(
|
||||
ISender sender,
|
||||
IHttpClientFactory clientFactory,
|
||||
|
||||
Reference in New Issue
Block a user