From fd1e5454da32d748bdcc63995aa13ce295f2082b Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Sat, 3 Jan 2026 16:24:34 -0500 Subject: [PATCH] feat(datasync): add BranchDevEtl pipeline for Branch table dev loading --- .../DevEtl/BranchDevEtl.cs | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 NEW/src/JdeScoping.DataSync/DevEtl/BranchDevEtl.cs diff --git a/NEW/src/JdeScoping.DataSync/DevEtl/BranchDevEtl.cs b/NEW/src/JdeScoping.DataSync/DevEtl/BranchDevEtl.cs new file mode 100644 index 0000000..ac83fff --- /dev/null +++ b/NEW/src/JdeScoping.DataSync/DevEtl/BranchDevEtl.cs @@ -0,0 +1,37 @@ +using JdeScoping.DataAccess.Interfaces; +using JdeScoping.DataSync.Etl.Destinations; +using JdeScoping.DataSync.Etl.Models; +using JdeScoping.DataSync.Etl.Pipeline; +using JdeScoping.DataSync.Etl.Sources; + +namespace JdeScoping.DataSync.DevEtl; + +/// +/// Development ETL pipeline for the Branch table. +/// +public static class BranchDevEtl +{ + public static readonly string TableName = "Branch"; + public static readonly string CacheFileName = "branch.json.zstd"; + + private static readonly JsonColumnSchema[] Schema = + [ + new("Code", typeof(string), IsNullable: false), + new("Description", typeof(string), IsNullable: true), + new("LastUpdateDT", typeof(DateTime), IsNullable: false), + ]; + + public static EtlPipeline Create(IDbConnectionFactory connectionFactory, string cacheFilePath) + { + ArgumentNullException.ThrowIfNull(connectionFactory); + + if (string.IsNullOrWhiteSpace(cacheFilePath)) + throw new ArgumentException("Cache file path is required.", nameof(cacheFilePath)); + + return new EtlPipelineBuilder() + .WithName($"{TableName}_Dev") + .WithSource(new JsonZstdFileSource(cacheFilePath, Schema)) + .WithDestination(new DbBulkImportDestination(connectionFactory, TableName)) + .Build(); + } +}