Files
ECMJobRunner/ECMJobRunner.Application/DEXJob/Commands/TriggeringDEXJobCommand.cs
TekH 8255f1f6aa feat(application): add inactive profile validation with custom exception
- Create InactiveProfileException for profile active status validation
- Update TriggeringDEXJobBatchCommand to check profile active status before execution
- Add ICfgProfileRepository dependency to batch command handler
- Throw InactiveProfileException when attempting to execute inactive profiles
- Add profile not found validation with descriptive error message
- Reorganize commands under DEXJob/Commands directory structure
2026-07-11 19:16:35 +02:00

52 lines
1.9 KiB
C#

using ECMJobRunner.Domain.Entities;
using MediatR;
using System.Threading;
using System.Threading.Tasks;
namespace ECMJobRunner.Application.DEXJob.Commands
{
/// <summary>
/// Command to trigger a single DEX job execution
/// Execution logic is handled by pipeline behaviors:
/// 1. MainQueryExecutionBehavior - executes main SQL query
/// 2. CheckQueryExecutionBehavior - validates with check SQL query
/// 3. ReCRequestExecutionBehavior - invokes ReC HTTP request
/// </summary>
public class TriggeringDEXJobCommand : IRequest<Unit>
{
/// <summary>
/// The SQL job to execute
/// </summary>
public ProfileSqlJob Job { get; set; } = null!;
/// <summary>
/// Unique batch identifier for this execution
/// </summary>
public string BatchId { get; set; } = null!;
}
/// <summary>
/// Handler for TriggeringDEXJobCommand
/// All execution logic is delegated to pipeline behaviors
/// This handler simply returns completion after behaviors execute
/// </summary>
public class TriggeringDEXJobCommandHandler : IRequestHandler<TriggeringDEXJobCommand, Unit>
{
/// <summary>
/// Handles the TriggeringDEXJobCommand
/// Returns immediately as behaviors perform all work
/// </summary>
/// <param name="request">The command containing job and batch ID</param>
/// <param name="cancellationToken">Cancellation token</param>
/// <returns>Unit value indicating completion</returns>
public Task<Unit> Handle(TriggeringDEXJobCommand request, CancellationToken cancellationToken)
{
// All execution logic is handled by pipeline behaviors:
// - MainQueryExecutionBehavior
// - CheckQueryExecutionBehavior
// - ReCRequestExecutionBehavior
return Task.FromResult(Unit.Value);
}
}
}