feat: Update Application layer for Hangfire integration
- Add CronSchedule property to CfgProfileDto for scheduling support - Create ProfileSqlJobDto for SQL job execution data transfer - Update TriggeringDEXJobBatchCommand to accept ProfileId and Jobs collection - Make TriggeringDEXJobBatchCommand public for Hangfire job activation - Update Application DependencyInjection with required service registrations
This commit is contained in:
@@ -7,7 +7,7 @@ namespace ECMJobRunner.Application.Common.Dtos
|
|||||||
/// Data Transfer Object for CfgProfile entity
|
/// Data Transfer Object for CfgProfile entity
|
||||||
/// Used for querying and returning profile data
|
/// Used for querying and returning profile data
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class CfgProfileDto
|
public record CfgProfileDto
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Profile ID
|
/// Profile ID
|
||||||
@@ -64,55 +64,4 @@ namespace ECMJobRunner.Application.Common.Dtos
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public List<ProfileSqlJobDto>? SqlJobs { get; set; }
|
public List<ProfileSqlJobDto>? SqlJobs { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Data Transfer Object for ProfileSqlJob entity
|
|
||||||
/// </summary>
|
|
||||||
public class ProfileSqlJobDto
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// SQL Job ID
|
|
||||||
/// </summary>
|
|
||||||
public long Id { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Profile ID (foreign key)
|
|
||||||
/// </summary>
|
|
||||||
public long ProfileId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Active / Inactive switch
|
|
||||||
/// </summary>
|
|
||||||
public bool Active { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Execution sequence order
|
|
||||||
/// </summary>
|
|
||||||
public short Sequence { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Job name
|
|
||||||
/// </summary>
|
|
||||||
public string? Name { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// SQL query for pre-check validation
|
|
||||||
/// </summary>
|
|
||||||
public string? SqlCheckQuery { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Main SQL query to execute
|
|
||||||
/// </summary>
|
|
||||||
public string? SqlMainQuery { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// API command to execute
|
|
||||||
/// </summary>
|
|
||||||
public string? ApiCommand { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Optional description
|
|
||||||
/// </summary>
|
|
||||||
public string? Comment { get; set; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
53
ECMJobRunner.Application/Common/Dtos/ProfileSqlJobDto.cs
Normal file
53
ECMJobRunner.Application/Common/Dtos/ProfileSqlJobDto.cs
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
namespace ECMJobRunner.Application.Common.Dtos
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Data Transfer Object for ProfileSqlJob entity
|
||||||
|
/// </summary>
|
||||||
|
public class ProfileSqlJobDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// SQL Job ID
|
||||||
|
/// </summary>
|
||||||
|
public long Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Profile ID (foreign key)
|
||||||
|
/// </summary>
|
||||||
|
public long ProfileId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Active / Inactive switch
|
||||||
|
/// </summary>
|
||||||
|
public bool Active { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Execution sequence order
|
||||||
|
/// </summary>
|
||||||
|
public short Sequence { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Job name
|
||||||
|
/// </summary>
|
||||||
|
public string? Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// SQL query for pre-check validation
|
||||||
|
/// </summary>
|
||||||
|
public string? SqlCheckQuery { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Main SQL query to execute
|
||||||
|
/// </summary>
|
||||||
|
public string? SqlMainQuery { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// API command to execute
|
||||||
|
/// </summary>
|
||||||
|
public string? ApiCommand { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Optional description
|
||||||
|
/// </summary>
|
||||||
|
public string? Comment { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,7 +17,7 @@ namespace ECMJobRunner.Application.DEXJob.Commands
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Profile ID to trigger all associated SQL jobs
|
/// Profile ID to trigger all associated SQL jobs
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int ProfileId { get; set; }
|
public long ProfileId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using ECMJobRunner.Application.Behaviors;
|
using ECMJobRunner.Application.Behaviors;
|
||||||
using MediatR;
|
using MediatR;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using ReC.Client;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
namespace ECMJobRunner.Application
|
namespace ECMJobRunner.Application
|
||||||
@@ -16,7 +17,7 @@ namespace ECMJobRunner.Application
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="services">The service collection</param>
|
/// <param name="services">The service collection</param>
|
||||||
/// <returns>The service collection for chaining</returns>
|
/// <returns>The service collection for chaining</returns>
|
||||||
public static IServiceCollection AddApplication(this IServiceCollection services)
|
public static IServiceCollection AddJobRunnerServices(this IServiceCollection services, string recClientApiUrl)
|
||||||
{
|
{
|
||||||
var assembly = Assembly.GetExecutingAssembly();
|
var assembly = Assembly.GetExecutingAssembly();
|
||||||
|
|
||||||
@@ -26,6 +27,10 @@ namespace ECMJobRunner.Application
|
|||||||
#else
|
#else
|
||||||
services.AddMediatR(cfg => cfg.RegisterServicesFromAssembly(assembly));
|
services.AddMediatR(cfg => cfg.RegisterServicesFromAssembly(assembly));
|
||||||
#endif
|
#endif
|
||||||
|
services.AddRecClient(recClientApiUrl, opt =>
|
||||||
|
{
|
||||||
|
opt.LogSuccessfulRequests = true;
|
||||||
|
});
|
||||||
|
|
||||||
// Register pipeline behaviors in execution order
|
// Register pipeline behaviors in execution order
|
||||||
// Order matters: MainQuery -> CheckQuery -> ReCRequest
|
// Order matters: MainQuery -> CheckQuery -> ReCRequest
|
||||||
|
|||||||
Reference in New Issue
Block a user