From f53603083ad78187b7c0a925fe8379fb1d571c9d Mon Sep 17 00:00:00 2001 From: TekH Date: Fri, 12 Dec 2025 15:00:26 +0100 Subject: [PATCH] Refactor batch invocation to use RecActionViews Replaced all batch RecAction logic with RecActionViews equivalents. Updated controller methods to call InvokeBatchRecActionView instead of InvokeBatchRecAction. Removed InvokeBatchRecActionsCommand and its handler, and added InvokeBatchRecActionViewsCommand with similar logic for RecActionViews. This shifts batch processing from RecActions to RecActionViews across the codebase. --- src/ReC.API/Controllers/RecActionController.cs | 4 ++-- ...ommand.cs => InvokeBatchRecActionViewsCommand.cs} | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) rename src/ReC.Application/RecActionViews/Commands/{InvokeBatchRecActionsCommand.cs => InvokeBatchRecActionViewsCommand.cs} (52%) diff --git a/src/ReC.API/Controllers/RecActionController.cs b/src/ReC.API/Controllers/RecActionController.cs index c902578..d1454b9 100644 --- a/src/ReC.API/Controllers/RecActionController.cs +++ b/src/ReC.API/Controllers/RecActionController.cs @@ -23,7 +23,7 @@ public class RecActionController(IMediator mediator, IConfiguration config) : Co [ProducesResponseType(StatusCodes.Status202Accepted)] public async Task Invoke([FromRoute] int profileId, CancellationToken cancel) { - await mediator.InvokeBatchRecAction(profileId, cancel); + await mediator.InvokeBatchRecActionView(profileId, cancel); return Accepted(); } @@ -36,7 +36,7 @@ public class RecActionController(IMediator mediator, IConfiguration config) : Co [ProducesResponseType(StatusCodes.Status202Accepted)] public async Task Invoke(CancellationToken cancel) { - await mediator.InvokeBatchRecAction(config.GetFakeProfileId(), cancel); + await mediator.InvokeBatchRecActionView(config.GetFakeProfileId(), cancel); return Accepted(); } diff --git a/src/ReC.Application/RecActionViews/Commands/InvokeBatchRecActionsCommand.cs b/src/ReC.Application/RecActionViews/Commands/InvokeBatchRecActionViewsCommand.cs similarity index 52% rename from src/ReC.Application/RecActionViews/Commands/InvokeBatchRecActionsCommand.cs rename to src/ReC.Application/RecActionViews/Commands/InvokeBatchRecActionViewsCommand.cs index 078950d..38e6e19 100644 --- a/src/ReC.Application/RecActionViews/Commands/InvokeBatchRecActionsCommand.cs +++ b/src/ReC.Application/RecActionViews/Commands/InvokeBatchRecActionViewsCommand.cs @@ -4,17 +4,17 @@ using ReC.Domain.Constants; namespace ReC.Application.RecActionViews.Commands; -public record InvokeBatchRecActionsCommand : ReadRecActionQueryBase, IRequest; +public record InvokeBatchRecActionViewsCommand : ReadRecActionQueryBase, IRequest; -public static class InvokeBatchRecActionsCommandExtensions +public static class InvokeBatchRecActionViewsCommandExtensions { - public static Task InvokeBatchRecAction(this ISender sender, long profileId, CancellationToken cancel = default) - => sender.Send(new InvokeBatchRecActionsCommand { ProfileId = profileId }, cancel); + public static Task InvokeBatchRecActionView(this ISender sender, long profileId, CancellationToken cancel = default) + => sender.Send(new InvokeBatchRecActionViewsCommand { ProfileId = profileId }, cancel); } -public class InvokeRecActionsCommandHandler(ISender sender) : IRequestHandler +public class InvokeRecActionViewsCommandHandler(ISender sender) : IRequestHandler { - public async Task Handle(InvokeBatchRecActionsCommand request, CancellationToken cancel) + public async Task Handle(InvokeBatchRecActionViewsCommand request, CancellationToken cancel) { var actions = await sender.Send(request.ToReadQuery(q => q.Invoked = false), cancel);