Refactor InvokeBatchRecActionViewsCommand structure
Decouple InvokeBatchRecActionViewsCommand from ReadRecActionQueryBase, making it a plain IRequest with an explicit ProfileId property. Update the extension and handler to use the new structure, improving clarity and separation of concerns.
This commit is contained in:
@@ -4,7 +4,10 @@ using ReC.Domain.Constants;
|
||||
|
||||
namespace ReC.Application.RecActionViews.Commands;
|
||||
|
||||
public record InvokeBatchRecActionViewsCommand : ReadRecActionQueryBase, IRequest;
|
||||
public record InvokeBatchRecActionViewsCommand : IRequest
|
||||
{
|
||||
public long ProfileId { get; init; }
|
||||
}
|
||||
|
||||
public static class InvokeBatchRecActionViewsCommandExtensions
|
||||
{
|
||||
@@ -16,7 +19,7 @@ public class InvokeRecActionViewsCommandHandler(ISender sender) : IRequestHandle
|
||||
{
|
||||
public async Task Handle(InvokeBatchRecActionViewsCommand request, CancellationToken cancel)
|
||||
{
|
||||
var actions = await sender.Send(request.ToReadQuery(q => q.Invoked = false), cancel);
|
||||
var actions = await sender.Send(new ReadRecActionViewQuery() { ProfileId = request.ProfileId, Invoked = false }, cancel);
|
||||
|
||||
foreach (var action in actions)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user