Renamed namespaces, classes, and commands from `DEXJob` to `ProfileJob` to align with the new "Profiles" context. Updated pipeline behaviors (`CheckQueryExecutionBehavior`, `MainQueryExecutionBehavior`, `ReCRequestExecutionBehavior`) to handle `TriggeringProfileJobCommand`. Refactored unit tests to reflect the new naming convention, including mock setups and assertions. Updated `DtoExtensions` to return `TriggeringProfileJobBatchCommand`. Adjusted queries and dependency injection to use the new `Profiles` namespace. Performed general refactoring to replace all references to "DEXJob" with "ProfileJob" in method names, variables, and documentation for consistency and clarity.
52 lines
1.9 KiB
C#
52 lines
1.9 KiB
C#
using ECMJobRunner.Domain.Entities;
|
|
using MediatR;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace ECMJobRunner.Application.Profiles.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 TriggeringProfileJobCommand : 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<TriggeringProfileJobCommand, 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(TriggeringProfileJobCommand request, CancellationToken cancellationToken)
|
|
{
|
|
// All execution logic is handled by pipeline behaviors:
|
|
// - MainQueryExecutionBehavior
|
|
// - CheckQueryExecutionBehavior
|
|
// - ReCRequestExecutionBehavior
|
|
return Task.FromResult(Unit.Value);
|
|
}
|
|
}
|
|
}
|