Remove batch result check from rec action invocation
Removed the check that blocked rec action invocation if results already existed for a batch. Also updated using directives for exception handling and logging.
This commit is contained in:
@@ -1,9 +1,7 @@
|
|||||||
using DigitalData.Core.Exceptions;
|
using MediatR;
|
||||||
using MediatR;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using ReC.Application.Common.Exceptions;
|
using ReC.Application.Common.Exceptions;
|
||||||
using ReC.Application.RecActions.Queries;
|
using ReC.Application.RecActions.Queries;
|
||||||
using ReC.Application.Results.Queries;
|
|
||||||
using ReC.Domain.Constants;
|
using ReC.Domain.Constants;
|
||||||
|
|
||||||
namespace ReC.Application.RecActions.Commands;
|
namespace ReC.Application.RecActions.Commands;
|
||||||
@@ -18,11 +16,6 @@ public class InvokeRecActionViewsCommandHandler(ISender sender, ILogger<InvokeRe
|
|||||||
{
|
{
|
||||||
public async Task Handle(InvokeBatchRecActionViewsCommand request, CancellationToken cancel)
|
public async Task Handle(InvokeBatchRecActionViewsCommand request, CancellationToken cancel)
|
||||||
{
|
{
|
||||||
var any = await sender.Send(new AnyResultViewQuery(BatchId: request.References.BatchId), cancel);
|
|
||||||
|
|
||||||
if(any)
|
|
||||||
throw new BadRequestException($"Cannot invoke rec actions for batch {request.References.BatchId} because there are already results associated with it.");
|
|
||||||
|
|
||||||
var actions = await sender.Send(new ReadRecActionViewQuery() { ProfileId = request.ProfileId }, cancel);
|
var actions = await sender.Send(new ReadRecActionViewQuery() { ProfileId = request.ProfileId }, cancel);
|
||||||
|
|
||||||
foreach (var action in actions)
|
foreach (var action in actions)
|
||||||
|
|||||||
Reference in New Issue
Block a user