diff --git a/ECMJobRunner.Application/Profiles/Commands/TriggeringProfileJobCommand.cs b/ECMJobRunner.Application/Profiles/Commands/TriggeringProfileJobCommand.cs
index dfb4bdd..b594f0e 100644
--- a/ECMJobRunner.Application/Profiles/Commands/TriggeringProfileJobCommand.cs
+++ b/ECMJobRunner.Application/Profiles/Commands/TriggeringProfileJobCommand.cs
@@ -1,5 +1,9 @@
-using ECMJobRunner.Domain.Entities;
+using ECMJobRunner.Application.ProfileHistories.Commands;
+using ECMJobRunner.Domain.Entities;
+using ECMJobRunner.Domain.Interfaces;
+using ECMJobRunner.Domain.ValueObjects;
using MediatR;
+using ReC.Client.Api;
using System.Threading;
using System.Threading.Tasks;
@@ -23,6 +27,8 @@ namespace ECMJobRunner.Application.Profiles.Commands
/// Unique batch identifier for this execution
///
public string BatchId { get; set; } = null!;
+
+ internal BatchRecActionViewResponse? RecActionResult { get; set; }
}
///
@@ -30,7 +36,7 @@ namespace ECMJobRunner.Application.Profiles.Commands
/// All execution logic is delegated to pipeline behaviors
/// This handler simply returns completion after behaviors execute
///
- public class TriggeringDEXJobCommandHandler : IRequestHandler
+ public class TriggeringDEXJobCommandHandler(ISender Sender) : IRequestHandler
{
///
/// Handles the TriggeringDEXJobCommand
@@ -39,13 +45,24 @@ namespace ECMJobRunner.Application.Profiles.Commands
/// The command containing job and batch ID
/// Cancellation token
/// Unit value indicating completion
- public Task Handle(TriggeringProfileJobCommand request, CancellationToken cancellationToken)
+ public async Task Handle(TriggeringProfileJobCommand request, CancellationToken cancellationToken)
{
// All execution logic is handled by pipeline behaviors:
// - MainQueryExecutionBehavior
// - CheckQueryExecutionBehavior
// - ReCRequestExecutionBehavior
- return Task.FromResult(Unit.Value);
+
+ var cmd = new CreateProfileHistoryCommand
+ {
+ Result = ResultType.Ok,
+ ResultText = $"Job '{request.Job.Name}' erfolgreich abgeschlossen. | Batch-ID: {request.BatchId} | Verarbeitete Aktionen: {request.RecActionResult?.TotalActionCount ?? 0} | Fehlgeschlagene Aktionen: {request.RecActionResult?.ActionExceptionCount ?? 0}",
+ ProfileId = request.Job.ProfileId,
+ AddedWho = "ECMJobRunner"
+ };
+
+ await Sender.Send(cmd, cancellationToken);
+
+ return Unit.Value;
}
}
}
diff --git a/ECMJobRunner.WebCron/ProfileWorker/DependencyInjection.cs b/ECMJobRunner.WebCron/ProfileWorker/DependencyInjection.cs
index 0bd4778..b83adc0 100644
--- a/ECMJobRunner.WebCron/ProfileWorker/DependencyInjection.cs
+++ b/ECMJobRunner.WebCron/ProfileWorker/DependencyInjection.cs
@@ -55,7 +55,7 @@ internal class ProfileWorkerOptionsValidator : IValidateOptionsThe options to validate.
///
/// if valid,
- /// or with error message if invalid.
+ /// or with error message if invalid.
///
///
/// Validation rules: