feat(datasync): add ScheduleConfig and ScheduleDefaults models

Add configuration models for the new schedule-based pipeline configuration:
- ScheduleConfig: Per-schedule configuration (Enabled, IntervalMinutes, PrePurge, ReIndex, UpdateWhen)
- ScheduleDefaults: Default configurations for Mass (weekly), Daily, and Hourly schedules
- PipelineSchedules: Per-pipeline schedule overrides
- MergeWith method for merging pipeline overrides with defaults

Part of Task 1 from pipeline-schedule-alignment implementation plan.
This commit is contained in:
Joseph Doherty
2026-01-07 00:18:28 -05:00
parent bd8cb87275
commit 1318dce18a
2 changed files with 274 additions and 0 deletions
@@ -0,0 +1,98 @@
namespace JdeScoping.DataSync.Configuration;
/// <summary>
/// Configuration for a single schedule type (Mass/Daily/Hourly).
/// </summary>
public record ScheduleConfig
{
/// <summary>
/// Whether this schedule is enabled.
/// </summary>
public bool Enabled { get; init; } = true;
/// <summary>
/// Interval in minutes between syncs.
/// </summary>
public int IntervalMinutes { get; init; }
/// <summary>
/// Whether to truncate the table before import (full reload).
/// </summary>
public bool PrePurge { get; init; }
/// <summary>
/// Whether to rebuild indexes after import.
/// </summary>
public bool ReIndex { get; init; }
/// <summary>
/// Condition for updating existing rows (e.g., "src.LastUpdateDt > tgt.LastUpdateDt").
/// </summary>
public string? UpdateWhen { get; init; }
/// <summary>
/// Merges this config with defaults. Non-null/non-default values in this config override defaults.
/// </summary>
public ScheduleConfig MergeWith(ScheduleConfig defaults)
{
return new ScheduleConfig
{
Enabled = Enabled,
IntervalMinutes = IntervalMinutes > 0 ? IntervalMinutes : defaults.IntervalMinutes,
PrePurge = PrePurge || defaults.PrePurge,
ReIndex = ReIndex || defaults.ReIndex,
UpdateWhen = UpdateWhen ?? defaults.UpdateWhen
};
}
}
/// <summary>
/// Default schedule configurations for all pipelines.
/// </summary>
public record ScheduleDefaults
{
/// <summary>
/// Default Mass schedule config (weekly, full reload).
/// </summary>
public ScheduleConfig Mass { get; init; } = new()
{
Enabled = true,
IntervalMinutes = 10080, // Weekly
PrePurge = true,
ReIndex = true
};
/// <summary>
/// Default Daily schedule config (incremental merge).
/// </summary>
public ScheduleConfig Daily { get; init; } = new()
{
Enabled = true,
IntervalMinutes = 1440, // Daily
PrePurge = false,
ReIndex = false,
UpdateWhen = "src.LastUpdateDt > tgt.LastUpdateDt"
};
/// <summary>
/// Default Hourly schedule config (incremental merge).
/// </summary>
public ScheduleConfig Hourly { get; init; } = new()
{
Enabled = true,
IntervalMinutes = 60, // Hourly
PrePurge = false,
ReIndex = false,
UpdateWhen = "src.LastUpdateDt > tgt.LastUpdateDt"
};
}
/// <summary>
/// Per-pipeline schedule overrides.
/// </summary>
public record PipelineSchedules
{
public ScheduleConfig? Mass { get; init; }
public ScheduleConfig? Daily { get; init; }
public ScheduleConfig? Hourly { get; init; }
}