Commit Graph

156 Commits

Author SHA1 Message Date
Joseph Doherty 1618b6664d refactor: remove unused CMS/JDE repositories and data sources
Remove legacy JDE and CMS direct-access code that is no longer used:
- Delete ICmsDataSource, IJdeDataSource interfaces
- Delete ISearchProcessor, IUpdateProcessor interfaces
- Delete IJdeRepository and ICmsRepository (all partials)
- Delete JdeRepository and CmsRepository implementations
- Delete JdeQueries and CmsQueries
- Delete JdeFileDataSource, JdeOracleDataSource
- Delete CmsFileDataSource, CmsOracleDataSource
- Remove unused methods from LotFinderRepository interfaces
- Delete associated unit tests (CmsRepositoryTests, JdeRepositoryTests)

All data sync now uses ETL pipelines via DataSync project.
2026-01-07 05:04:49 -05:00
Joseph Doherty 6952f686fa perf: optimize ExcelIO tests with fixture-based consolidation
- Add WorkbookFixtureBase and 4 concrete fixtures for shared workbooks
- Add ExcelTestHelpers with shared utility methods
- Create Integration/ folder with 7 fixture-based test classes:
  - MinimalSearchTests (5 tests)
  - SearchResultsSheetTests (5 tests)
  - MisInfoSheetTests (11 tests)
  - InvestigationSheetTests (7 tests)
  - ProtectionAndStyleTests (7 tests)
  - LegacyFormatTests (5 tests)
  - LargeDataSetTests (1 test)
- Delete redundant ExcelExportIntegrationTests.cs (26 tests)
- Delete redundant LegacyComparisonTests.cs (16 tests)
- Reduce workbook generations from ~42 to 4 fixtures
- Test runtime reduced from ~18 min to ~4 min (76% improvement)
- All 122 ExcelIO tests pass
2026-01-07 03:55:33 -05:00
Joseph Doherty 884d3a093b chore(datasync): mark SyncMode and SyncModeConfig as obsolete 2026-01-07 01:58:01 -05:00
Joseph Doherty fc5769b219 test: fix ServiceRegistrationTests config key (Ldap:UseFakeAuth) 2026-01-07 01:56:34 -05:00
Joseph Doherty b0619dc49f config: add GIW connection string placeholder 2026-01-07 01:47:38 -05:00
Joseph Doherty 8a852eac41 feat(datasync): add 8 missing pipeline definitions
Add pipeline definitions for:
- WorkOrderTime_Curr (JDE F31122_VIEW)
- WorkOrderComponent_Curr (JDE F3111_VIEW)
- WorkOrderStep_Curr (JDE F3112_VIEW with F00192_VIEW join)
- WorkOrderRouting (JDE F3112Z1_VIEW)
- StatusCode (GIW F0005_VIEW - uses giw connection)
- OrgHierarchy (JDE F30006_VIEW)
- RouteMaster (JDE F3003_VIEW)
- FunctionCode (JDE PRODDTA.F00192 - always full reload)

Update MisData pipeline:
- Set mass.intervalMinutes to 100800 (10x default)
- Disable hourly schedule
2026-01-07 01:44:50 -05:00
Joseph Doherty 3af06b6aff refactor(datasync): migrate pipelines to new schedule schema
- Add scheduleDefaults with mass/daily/hourly defaults
- Add massQuery (unfiltered) to each pipeline for Mass schedule
- Add schedules section to each pipeline inheriting defaults
- Keep syncModes for backward compatibility
2026-01-07 01:39:22 -05:00
Joseph Doherty da02784feb feat(datasync): add custom interval support to DataUpdateRepository
Add optional customIntervals parameter to GetSyncStatusAsync to allow
per-pipeline interval overrides instead of hardcoded defaults. This
enables tables like MisData to use longer sync intervals (e.g., 70 days)
while other tables use standard intervals.

Key changes:
- IDataUpdateRepository.GetSyncStatusAsync now accepts an optional
  Dictionary<string, int> for custom intervals keyed by "TableName_UpdateType"
- GetExpectedInterval and IsOverdue made public static for testing and reuse
- Added GetDefaultInterval method for accessing default values
- Updated DataSyncHealthCheck to use new signature
- Added comprehensive unit tests for custom interval behavior
2026-01-07 01:35:28 -05:00
Joseph Doherty e234c9f29a refactor(datasync): use WithUpdateType instead of WithMode in TableSyncOperation
Update TableSyncOperation to pass UpdateTypes directly to the pipeline
builder using WithUpdateType() instead of mapping to SyncMode and calling
the deprecated WithMode() method. This enables proper schedule-based
configuration handling where Daily and Hourly have distinct behaviors.

- Remove SyncMode mapping logic from ExecuteSyncCoreAsync
- Call WithUpdateType(task.UpdateType) directly
- Update log message to reflect UpdateType instead of SyncMode
- Add TableSyncOperationTests verifying WithUpdateType is called correctly
2026-01-07 01:25:24 -05:00
Joseph Doherty bb54994f2d feat(datasync): add WithUpdateType to IEtlPipelineBuilder
- Add WithUpdateType(UpdateTypes) method to IEtlPipelineBuilder interface
- Mark existing WithMode(SyncMode) as [Obsolete("Use WithUpdateType instead")]
- Update PipelineBuilder to store UpdateTypes instead of SyncMode
- Add GetEffectiveScheduleConfig method to merge pipeline schedules with defaults
- Add BuildWithSchedules method for new Schedules-based config
- Update validation to support both old SyncModes and new Schedules formats
- Pass ScheduleDefaults from PipelinesRoot to PipelineBuilder
- For Mass mode: use massQuery, apply prePurge/reIndex from schedule config
- For Daily/Hourly: use regular query with date parameters
- Add 8 new tests for WithUpdateType functionality
2026-01-07 01:15:18 -05:00
Joseph Doherty 4b3c900d52 feat(datasync): add GIW connection type to DbQuerySource
Add support for "giw" connection type in DbQuerySource to enable
the StatusCode pipeline to query from the GIW Oracle database.
2026-01-07 01:08:52 -05:00
Joseph Doherty c59a3160d0 feat(dataaccess): add GIW connection factory method
Add CreateGiwConnectionAsync to IDbConnectionFactory and DbConnectionFactory
for connecting to the GIW Oracle database. This connection is needed for the
StatusCode data sync pipeline.

- Reuses existing CreateOracleConnectionAsync helper with "GIW" data source
- Follows same pattern as JDE, JDEStage, and CMS connections
- Includes 4 unit tests covering missing/empty/invalid connection strings
2026-01-07 00:54:11 -05:00
Joseph Doherty 21f598f25c feat(datasync): add Schedules property to PipelineConfig
Add PipelineSchedules? Schedules parameter to PipelineConfig record between
SyncModes and Transformers for new schedule-based configuration. The existing
SyncModes property is now nullable for backward compatibility during the
transition to the new schedule system.
2026-01-07 00:41:03 -05:00
Joseph Doherty 15cfc1a010 feat(datasync): add ScheduleDefaults to PipelinesRoot
Add ScheduleDefaults? parameter to PipelinesRoot record and
EffectiveScheduleDefaults computed property that returns
defaults when null.

Updates all existing test usages to include the new parameter.
2026-01-07 00:33:18 -05:00
Joseph Doherty 1318dce18a 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.
2026-01-07 00:18:28 -05:00
Joseph Doherty 621dd41a97 refactor(ExcelIO): delete old attribute-based infrastructure
- Remove OutputColumnAttribute, OutputTableAttribute, OutputColumnCache
- Remove AttributeTableWriter and ColumnFormatter
- Remove duplicate ExcelFormats from Mapping (use Formatting version)
- Remove OutputColumn model
- Add FilterEntryMaps for criteria sheet filter models
- Update CriteriaSheetGenerator to use FluentTableWriter
- Remove attributes from filter entry models (now use fluent maps)
- Update DI to register filter entry maps and remove old services
- Update tests to use new fluent infrastructure
- Delete obsolete test files for removed infrastructure

Task 16 of fluent-excel-mapping-implementation plan.
2026-01-06 23:56:02 -05:00
Joseph Doherty e98ce636e2 refactor(ExcelIO): remove duplicate result models (now in Core) 2026-01-06 23:46:54 -05:00
Joseph Doherty 4fbd264181 refactor(DataAccess): remove duplicate Models and Attributes (now in Core/ExcelIO) 2026-01-06 23:42:42 -05:00
Joseph Doherty e36eb27947 refactor(DataAccess): use Core.Models.SearchResults 2026-01-06 23:40:02 -05:00
Joseph Doherty 8883fb2680 refactor(ExcelIO): migrate ExcelExportService to Core models and FluentTableWriter
- Replace AttributeTableWriter with FluentTableWriter in ExcelExportService
- Inject ExcelMapRegistry for fluent map lookups
- Use registry.GetMap<T>().TabName instead of reflection-based attribute reading
- Update ExcelIO SearchModel to reference Core result types via aliases
- Remove System.Reflection import (no longer needed)
- Add JdeScoping.Core.Models.SearchResults import for result types
2026-01-06 23:38:30 -05:00
Joseph Doherty a6b7f646b1 feat(ExcelIO): register ExcelMapRegistry and FluentTableWriter in DI 2026-01-06 23:33:05 -05:00
Joseph Doherty 62baafb1b4 feat(ExcelIO): add FluentTableWriter using map registry 2026-01-06 23:31:26 -05:00
Joseph Doherty ccf70a9857 feat(ExcelIO): add fluent maps for SearchResult models 2026-01-06 23:29:20 -05:00
Joseph Doherty 14fdba2784 feat(Core): add SearchResults models as pure POCOs 2026-01-06 23:27:47 -05:00
Joseph Doherty 671f8ce357 test(ExcelIO): add unit tests for fluent mapping infrastructure 2026-01-06 23:26:11 -05:00
Joseph Doherty b48ef586ac feat(ExcelIO): add ExcelMapRegistry for DI integration 2026-01-06 23:23:57 -05:00
Joseph Doherty 45243aa3ca feat(ExcelIO): add ExcelClassMap base class with fluent Map method 2026-01-06 23:23:51 -05:00
Joseph Doherty 48180259d2 feat(ExcelIO): add ColumnBuilder fluent API 2026-01-06 23:22:56 -05:00
Joseph Doherty 6c58394640 feat(ExcelIO): add ExcelFormats constants 2026-01-06 23:22:55 -05:00
Joseph Doherty bfbec425f4 feat(ExcelIO): add ColumnDefinition for fluent mapping 2026-01-06 23:21:28 -05:00
Joseph Doherty 6a8250ef60 docs: update DevEtlRegistry comment for protobuf 2026-01-06 16:44:25 -05:00
Joseph Doherty 81f0c3f289 chore: remove obsolete JSON source files 2026-01-06 16:43:53 -05:00
Joseph Doherty ead3496cdf refactor: migrate all DevEtl files to protobuf source
Replace JsonZstdFileSource with ProtobufZstdFileSource across all 20
DevEtl pipeline files. This removes the need for manually defined
JsonColumnSchema arrays as protobuf files embed their schema.

Changes per file:
- Remove using JdeScoping.DataSync.Dev.Models
- Remove private JsonColumnSchema[] Schema array
- Change CacheFileName from .json.zstd to .pb.zstd
- Change WithSource from JsonZstdFileSource to ProtobufZstdFileSource
2026-01-06 16:42:56 -05:00
Joseph Doherty ca63b674f5 refactor: migrate BranchDevEtl to protobuf source 2026-01-06 16:40:19 -05:00
Joseph Doherty 055406431d feat: add ProtobufZstdFileSource for reading protobuf cache files 2026-01-06 16:39:35 -05:00
Joseph Doherty d503fec7cc deps: add protobuf-net-data to DataSync.Dev 2026-01-06 16:38:47 -05:00
Joseph Doherty 2c82ac78e3 test: update test to use SqlObjects.SubmitSearch constant 2026-01-06 16:05:06 -05:00
Joseph Doherty e5b9c18352 feat(data-access): add SqlObjects constants and update references
Add centralized SqlObjects class with constants for stored procedure
and function names using usp_/fn_ prefixes. Update LotFinderRepository
and MisQueryBuilder to use the new naming convention.
2026-01-06 15:50:21 -05:00
Joseph Doherty b797f55ac5 refactor(db): rename stored procedures to usp_ and function to fn_ prefix 2026-01-06 15:48:58 -05:00
Joseph Doherty 645ef46f35 refactor(data-access): replace TVP lookups with STRING_SPLIT and OPENJSON
Remove dependency on deleted SQL Server Table-Valued Parameter types
by refactoring lookup methods to use built-in SQL Server functions:

- Simple single-value lookups (Items, WorkOrders, WorkCenters,
  ProfitCenters, Users) now use STRING_SPLIT with comma-separated
  strings from C#
- Complex multi-column lookup (Lots with LotNumber + ItemNumber)
  now uses OPENJSON with JSON string from C#

This eliminates the need for TVP type definitions (scripts 033-039)
while maintaining equivalent functionality.
2026-01-06 15:34:39 -05:00
Joseph Doherty 691a6d1ffd refactor(data-access): remove TVP code and simplify SearchModel
- Remove all List<*FilterEntry> properties and *FilterEnabled computed properties from SearchModel
- Delete TableValuedParameterExtensions.cs
- Delete entire FilterEntries folder and all filter entry model classes
- Delete FilterHandlers folder and all filter handler classes
- Delete IFilterHandler interface and FilterResult model
- Update MisQueryBuilder to use SQL extraction functions instead of model properties
- Update SearchProcessor to get ExtractMisData from database using fn_GetSearchExtractMisData
- Update DependencyInjection to remove filter handler registrations
- Delete obsolete tests for TVP extensions and filter handlers

Filter criteria are now stored as JSON in Search.Criteria column and extracted using SQL functions (fn_GetSearch*) during query execution.
2026-01-06 14:32:03 -05:00
Joseph Doherty a2a8bb3e9f refactor(datasync): remove obsolete DataSourceConfig properties 2026-01-06 14:25:46 -05:00
Joseph Doherty edd07858a1 refactor(datasync): remove obsolete appsettings properties
Remove legacy ETL properties from DataSources configuration:
- FetcherTypeName (9 entries)
- PostProcessorTypeName (1 entry - MisData)
- PrepurgeData from MassConfig (9 entries)
- ReIndexData from MassConfig (9 entries)

These properties were used by the old fetcher-based ETL system
and are no longer needed with the new EtlPipeline architecture.
2026-01-06 14:24:19 -05:00
Joseph Doherty 3c728dd575 refactor(datasync): update tests to remove FetcherTypeName
- Remove FetcherTypeName assignments from test fixtures in ScheduleCheckerTests
  and SyncOrchestratorTests
- Remove PrepurgeData and ReIndexData assignments from MassConfig in tests
- Mark FetcherTypeName, PostProcessorTypeName, PrepurgeData, and ReIndexData
  as obsolete with deprecation warnings pointing to pipelines.json
- Change FetcherTypeName from required to optional to allow tests to compile
  without providing the deprecated property
2026-01-06 14:22:26 -05:00
Joseph Doherty edff5859b9 docs: add protobuf cache conversion implementation plan
10-task plan covering converter tool creation, ProtobufZstdFileSource,
DevEtl migrations, and cleanup of obsolete JSON source files.
2026-01-06 14:18:27 -05:00
Joseph Doherty 8ce9a7dae1 docs: switch cache conversion design from MessagePack to protobuf-net-data
protobuf-net-data is purpose-built for IDataReader serialization and
returns IDataReader directly from Deserialize(), eliminating the need
for custom streaming reader implementations.
2026-01-06 14:15:19 -05:00
Joseph Doherty 4965b49c4e refactor(datasync): remove obsolete integration tests project 2026-01-06 14:13:43 -05:00
Joseph Doherty d4135e8ad3 fix(data-access): correct self-referential SQL in WorkCenter filter
The WHERE clause was comparing Code to itself instead of the aliased
table reference, which would always be true.
2026-01-06 14:12:07 -05:00
Joseph Doherty 34daf6a83b refactor(datasync): delete old ETL source files 2026-01-06 14:11:13 -05:00
Joseph Doherty 6074424524 refactor(data-access): update ISearchQueryBuilder to use SearchId only
- Change interface methods to accept int searchId instead of SearchModel
- Update SqlKataSearchQueryBuilder to generate SQL using extraction functions
- SQL now calls dbo.fn_GetSearchWorkOrders(@SearchId) etc instead of TVPs
- Update SearchProcessor to pass model.Id to query builder
- Update tests for new method signatures
2026-01-06 14:08:47 -05:00