Files
jdescopingtool/PLANS/2026-01-01-architecture-cleanup-implementation.md
T
Joseph Doherty 26ff8d9b4f Initial commit: JDE Scoping Tool migration project
Set up repository with legacy .NET Framework 4.8 source (OLD/),
new .NET 10 Blazor solution (NEW/), OpenSpec specifications,
documentation, and project configuration.
2026-01-02 07:43:29 -05:00

36 KiB

Architecture Cleanup Implementation Plan

For Claude: REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.

Goal: Refactor the solution to achieve full Clean Architecture compliance by consolidating interfaces, creating Infrastructure project, merging SearchProcessing into DataAccess, and cleaning up Core.

Architecture: Create new Infrastructure project for external system implementations (Oracle, LDAP). Consolidate all ILotFinderRepository partials into Core. Merge SearchProcessing into DataAccess. Enable Client to reference Core for shared ViewModels.

Tech Stack: .NET 10, Dapper, Oracle.ManagedDataAccess, System.DirectoryServices.Protocols, ClosedXML


Phase 1: Create Infrastructure Project

Task 1.1: Create Infrastructure Project Structure

Files:

  • Create: NEW/src/JdeScoping.Infrastructure/JdeScoping.Infrastructure.csproj

Step 1: Create project directory

Run:

mkdir -p /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.Infrastructure/Sources/Jde
mkdir -p /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.Infrastructure/Sources/Cms
mkdir -p /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.Infrastructure/Auth
mkdir -p /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.Infrastructure/Extensions

Step 2: Create project file

Create file NEW/src/JdeScoping.Infrastructure/JdeScoping.Infrastructure.csproj:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net10.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Dapper" Version="2.1.66" />
    <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="10.0.1" />
    <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.1" />
    <PackageReference Include="Microsoft.Extensions.Options" Version="10.0.1" />
    <PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="10.0.1" />
    <PackageReference Include="Oracle.ManagedDataAccess.Core" Version="23.26.0" />
    <PackageReference Include="System.DirectoryServices.Protocols" Version="10.0.1" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\JdeScoping.Core\JdeScoping.Core.csproj" />
  </ItemGroup>

</Project>

Step 3: Verify project file created

Run:

cat /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.Infrastructure/JdeScoping.Infrastructure.csproj

Expected: Shows the XML content above.


Task 1.2: Move JDE Oracle Data Source

Files:

  • Move: NEW/src/JdeScoping.Core/Repositories/Jde/JdeOracleDataSource.csNEW/src/JdeScoping.Infrastructure/Sources/Jde/JdeOracleDataSource.cs

Step 1: Copy file to new location

Run:

cp /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.Core/Repositories/Jde/JdeOracleDataSource.cs /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.Infrastructure/Sources/Jde/JdeOracleDataSource.cs

Step 2: Update namespace in new file

Edit NEW/src/JdeScoping.Infrastructure/Sources/Jde/JdeOracleDataSource.cs:

Change:

namespace JdeScoping.Core.Repositories.Jde;

To:

namespace JdeScoping.Infrastructure.Sources.Jde;

Step 3: Delete original file

Run:

rm /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.Core/Repositories/Jde/JdeOracleDataSource.cs

Task 1.3: Move JDE File Data Source

Files:

  • Move: NEW/src/JdeScoping.Core/Repositories/Jde/JdeFileDataSource.csNEW/src/JdeScoping.Infrastructure/Sources/Jde/JdeFileDataSource.cs

Step 1: Copy file to new location

Run:

cp /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.Core/Repositories/Jde/JdeFileDataSource.cs /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.Infrastructure/Sources/Jde/JdeFileDataSource.cs

Step 2: Update namespace in new file

Edit NEW/src/JdeScoping.Infrastructure/Sources/Jde/JdeFileDataSource.cs:

Change:

namespace JdeScoping.Core.Repositories.Jde;

To:

namespace JdeScoping.Infrastructure.Sources.Jde;

Step 3: Delete original file

Run:

rm /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.Core/Repositories/Jde/JdeFileDataSource.cs

Task 1.4: Move CMS Oracle Data Source

Files:

  • Move: NEW/src/JdeScoping.Core/Repositories/Cms/CmsOracleDataSource.csNEW/src/JdeScoping.Infrastructure/Sources/Cms/CmsOracleDataSource.cs

Step 1: Copy file to new location

Run:

cp /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.Core/Repositories/Cms/CmsOracleDataSource.cs /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.Infrastructure/Sources/Cms/CmsOracleDataSource.cs

Step 2: Update namespace in new file

Edit NEW/src/JdeScoping.Infrastructure/Sources/Cms/CmsOracleDataSource.cs:

Change:

namespace JdeScoping.Core.Repositories.Cms;

To:

namespace JdeScoping.Infrastructure.Sources.Cms;

Step 3: Delete original file

Run:

rm /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.Core/Repositories/Cms/CmsOracleDataSource.cs

Task 1.5: Move CMS File Data Source

Files:

  • Move: NEW/src/JdeScoping.Core/Repositories/Cms/CmsFileDataSource.csNEW/src/JdeScoping.Infrastructure/Sources/Cms/CmsFileDataSource.cs

Step 1: Copy file to new location

Run:

cp /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.Core/Repositories/Cms/CmsFileDataSource.cs /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.Infrastructure/Sources/Cms/CmsFileDataSource.cs

Step 2: Update namespace in new file

Edit NEW/src/JdeScoping.Infrastructure/Sources/Cms/CmsFileDataSource.cs:

Change:

namespace JdeScoping.Core.Repositories.Cms;

To:

namespace JdeScoping.Infrastructure.Sources.Cms;

Step 3: Delete original file

Run:

rm /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.Core/Repositories/Cms/CmsFileDataSource.cs

Task 1.6: Move LDAP Auth Service

Files:

  • Move: NEW/src/JdeScoping.Core/Auth/LdapAuthService.csNEW/src/JdeScoping.Infrastructure/Auth/LdapAuthService.cs

Step 1: Copy file to new location

Run:

cp /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.Core/Auth/LdapAuthService.cs /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.Infrastructure/Auth/LdapAuthService.cs

Step 2: Update namespace in new file

Edit NEW/src/JdeScoping.Infrastructure/Auth/LdapAuthService.cs:

Change:

namespace JdeScoping.Core.Auth;

To:

namespace JdeScoping.Infrastructure.Auth;

Also add using for Core interfaces:

using JdeScoping.Core.Auth;

Step 3: Delete original file

Run:

rm /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.Core/Auth/LdapAuthService.cs

Task 1.7: Create Infrastructure Service Extensions

Files:

  • Create: NEW/src/JdeScoping.Infrastructure/Extensions/InfrastructureServiceExtensions.cs
  • Delete: NEW/src/JdeScoping.Core/Extensions/DataSourceServiceExtensions.cs
  • Delete: NEW/src/JdeScoping.Core/Extensions/AuthServiceExtensions.cs

Step 1: Create new extension file

Create file NEW/src/JdeScoping.Infrastructure/Extensions/InfrastructureServiceExtensions.cs:

using JdeScoping.Core.Auth;
using JdeScoping.Core.Interfaces;
using JdeScoping.Core.Options;
using JdeScoping.Infrastructure.Auth;
using JdeScoping.Infrastructure.Sources.Cms;
using JdeScoping.Infrastructure.Sources.Jde;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

namespace JdeScoping.Infrastructure.Extensions;

/// <summary>
/// Extension methods for registering infrastructure services.
/// </summary>
public static class InfrastructureServiceExtensions
{
    /// <summary>
    /// Adds infrastructure services (data sources, auth) to the service collection.
    /// </summary>
    /// <param name="services">The service collection.</param>
    /// <param name="configuration">The configuration.</param>
    /// <returns>The service collection for chaining.</returns>
    public static IServiceCollection AddInfrastructure(
        this IServiceCollection services,
        IConfiguration configuration)
    {
        // Bind configuration
        services.Configure<DataSourceOptions>(
            configuration.GetSection(DataSourceOptions.SectionName));
        services.Configure<AuthOptions>(
            configuration.GetSection(AuthOptions.SectionName));

        // Register data sources based on configuration
        var dataSourceOptions = configuration
            .GetSection(DataSourceOptions.SectionName)
            .Get<DataSourceOptions>();

        if (dataSourceOptions?.UseFileDataSource == true)
        {
            services.AddScoped<IJdeDataSource, JdeFileDataSource>();
            services.AddScoped<ICmsDataSource, CmsFileDataSource>();
        }
        else
        {
            services.AddScoped<IJdeDataSource, JdeOracleDataSource>();
            services.AddScoped<ICmsDataSource, CmsOracleDataSource>();
        }

        // Register auth service based on configuration
        var authOptions = configuration
            .GetSection(AuthOptions.SectionName)
            .Get<AuthOptions>();

        if (authOptions?.UseFakeAuth == true)
        {
            services.AddScoped<IAuthService, FakeAuthService>();
        }
        else
        {
            services.AddScoped<IAuthService, LdapAuthService>();
        }

        return services;
    }
}

Step 2: Delete old Core extension files

Run:

rm /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.Core/Extensions/DataSourceServiceExtensions.cs
rm /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.Core/Extensions/AuthServiceExtensions.cs

Task 1.8: Clean up empty Core directories

Step 1: Remove empty Repositories directories

Run:

rmdir /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.Core/Repositories/Jde 2>/dev/null || true
rmdir /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.Core/Repositories/Cms 2>/dev/null || true
rmdir /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.Core/Repositories 2>/dev/null || true

Task 1.9: Add Infrastructure to Solution

Files:

  • Modify: NEW/JdeScoping.slnx

Step 1: Update solution file

Edit NEW/JdeScoping.slnx to add Infrastructure project:

Change:

<Folder Name="/src/">
    <Project Path="src/JdeScoping.Api/JdeScoping.Api.csproj" />
    <Project Path="src/JdeScoping.Client/JdeScoping.Client.csproj" />
    <Project Path="src/JdeScoping.Core/JdeScoping.Core.csproj" />

To:

<Folder Name="/src/">
    <Project Path="src/JdeScoping.Api/JdeScoping.Api.csproj" />
    <Project Path="src/JdeScoping.Client/JdeScoping.Client.csproj" />
    <Project Path="src/JdeScoping.Core/JdeScoping.Core.csproj" />
    <Project Path="src/JdeScoping.Infrastructure/JdeScoping.Infrastructure.csproj" />

Task 1.10: Add Infrastructure Reference to Host

Files:

  • Modify: NEW/src/JdeScoping.Host/JdeScoping.Host.csproj

Step 1: Read current Host.csproj

Read the file to find the ItemGroup with ProjectReferences.

Step 2: Add Infrastructure reference

Add to the ProjectReference ItemGroup:

<ProjectReference Include="..\JdeScoping.Infrastructure\JdeScoping.Infrastructure.csproj" />

Task 1.11: Update Host Program.cs

Files:

  • Modify: NEW/src/JdeScoping.Host/Program.cs

Step 1: Update using statements

Add:

using JdeScoping.Infrastructure.Extensions;

Remove:

using JdeScoping.Core.Extensions;

Step 2: Update service registration

Change:

builder.Services
    .AddDataAccess(builder.Configuration)       // 1. Database access configuration
    .AddDataSource(builder.Configuration)       // 2. Data source registration (JDE/CMS)

To:

builder.Services
    .AddDataAccess(builder.Configuration)       // 1. Database access configuration
    .AddInfrastructure(builder.Configuration)   // 2. Infrastructure (JDE/CMS/Auth)

Task 1.12: Build and verify Phase 1

Step 1: Build the solution

Run:

cd /Users/dohertj2/Desktop/JdeScopingTool/NEW && dotnet build

Expected: Build succeeded.

Step 2: Commit Phase 1

Run:

cd /Users/dohertj2/Desktop/JdeScopingTool/NEW && git add -A && git commit -m "refactor: create Infrastructure project, move Oracle/LDAP implementations from Core"

Phase 2: Consolidate ILotFinderRepository Interfaces

Task 2.1: Move DataSync Interface to Core

Files:

  • Move: NEW/src/JdeScoping.DataAccess/Interfaces/ILotFinderRepository.DataSync.csNEW/src/JdeScoping.Core/Interfaces/ILotFinderRepository.DataSync.cs

Step 1: Copy file

Run:

cp /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.DataAccess/Interfaces/ILotFinderRepository.DataSync.cs /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.Core/Interfaces/ILotFinderRepository.DataSync.cs

Step 2: Update namespace

Edit NEW/src/JdeScoping.Core/Interfaces/ILotFinderRepository.DataSync.cs:

Change:

namespace JdeScoping.DataAccess.Interfaces;

To:

namespace JdeScoping.Core.Interfaces;

Step 3: Delete original

Run:

rm /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.DataAccess/Interfaces/ILotFinderRepository.DataSync.cs

Task 2.2: Move SearchManagement Interface to Core

Files:

  • Move: NEW/src/JdeScoping.DataAccess/Interfaces/ILotFinderRepository.SearchManagement.csNEW/src/JdeScoping.Core/Interfaces/ILotFinderRepository.SearchManagement.cs

Step 1: Copy file

Run:

cp /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.DataAccess/Interfaces/ILotFinderRepository.SearchManagement.cs /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.Core/Interfaces/ILotFinderRepository.SearchManagement.cs

Step 2: Update namespace

Edit NEW/src/JdeScoping.Core/Interfaces/ILotFinderRepository.SearchManagement.cs:

Change:

namespace JdeScoping.DataAccess.Interfaces;

To:

namespace JdeScoping.Core.Interfaces;

Step 3: Delete original

Run:

rm /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.DataAccess/Interfaces/ILotFinderRepository.SearchManagement.cs

Task 2.3: Merge Lookups Interfaces

The Core and DataAccess both have .Lookups.cs files. We need to merge them.

Files:

  • Modify: NEW/src/JdeScoping.Core/Interfaces/ILotFinderRepository.Lookups.cs
  • Delete: NEW/src/JdeScoping.DataAccess/Interfaces/ILotFinderRepository.Lookups.cs

Step 1: Review both files and merge

The Core version has:

  • SearchItemsAsync, SearchProfitCentersAsync, SearchWorkCentersAsync, SearchUsersAsync
  • LookupWorkOrdersAsync, LookupItemsAsync, LookupLotsAsync

The DataAccess version has:

  • SearchItemsAsync, SearchWorkCentersAsync, SearchProfitCentersAsync, SearchUsersAsync
  • LookupItemsAsync, LookupWorkordersAsync, LookupWorkCentersAsync, LookupProfitCentersAsync, LookupUsersAsync, LookupLotsAsync

Step 2: Update Core Lookups to include all methods

Replace NEW/src/JdeScoping.Core/Interfaces/ILotFinderRepository.Lookups.cs with:

using JdeScoping.Core.Models.Inventory;
using JdeScoping.Core.Models.Organization;
using JdeScoping.Core.Models.WorkOrders;
using JdeScoping.Core.ViewModels;

namespace JdeScoping.Core.Interfaces;

/// <summary>
/// Lookup operations for LotFinder data repository.
/// </summary>
public partial interface ILotFinderRepository
{
    /// <summary>
    /// Searches for items matching the query (top 25).
    /// </summary>
    Task<List<Item>> SearchItemsAsync(string filter, CancellationToken cancellationToken = default);

    /// <summary>
    /// Searches for profit centers matching the query (top 25).
    /// </summary>
    Task<List<ProfitCenter>> SearchProfitCentersAsync(string filter, CancellationToken cancellationToken = default);

    /// <summary>
    /// Searches for work centers matching the query (top 25).
    /// </summary>
    Task<List<WorkCenter>> SearchWorkCentersAsync(string filter, CancellationToken cancellationToken = default);

    /// <summary>
    /// Searches for JDE users (operators) matching the query (top 25).
    /// </summary>
    Task<List<JdeUser>> SearchUsersAsync(string filter, CancellationToken cancellationToken = default);

    /// <summary>
    /// Looks up items by exact item numbers.
    /// </summary>
    Task<List<Item>> LookupItemsAsync(List<string> itemNumbers, CancellationToken cancellationToken = default);

    /// <summary>
    /// Looks up work orders by work order numbers.
    /// </summary>
    Task<List<WorkOrder>> LookupWorkordersAsync(List<long> workorderNumbers, CancellationToken cancellationToken = default);

    /// <summary>
    /// Looks up work centers by codes.
    /// </summary>
    Task<List<WorkCenter>> LookupWorkCentersAsync(List<string> codes, CancellationToken cancellationToken = default);

    /// <summary>
    /// Looks up profit centers by codes.
    /// </summary>
    Task<List<ProfitCenter>> LookupProfitCentersAsync(List<string> codes, CancellationToken cancellationToken = default);

    /// <summary>
    /// Looks up users by user IDs or address numbers.
    /// </summary>
    Task<List<JdeUser>> LookupUsersAsync(List<string> userIds, CancellationToken cancellationToken = default);

    /// <summary>
    /// Looks up lots by lot number and item number.
    /// </summary>
    Task<List<Lot>> LookupLotsAsync(List<LotViewModel> lots, CancellationToken cancellationToken = default);
}

Step 3: Delete DataAccess Lookups file

Run:

rm /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.DataAccess/Interfaces/ILotFinderRepository.Lookups.cs

Task 2.4: Delete remaining DataAccess ILotFinderRepository files

Files:

  • Delete: NEW/src/JdeScoping.DataAccess/Interfaces/ILotFinderRepository.cs

Step 1: Delete base interface file

Run:

rm /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.DataAccess/Interfaces/ILotFinderRepository.cs

Task 2.5: Update DataAccess ServiceCollectionExtensions

Files:

  • Modify: NEW/src/JdeScoping.DataAccess/Extensions/ServiceCollectionExtensions.cs

Step 1: Update using statement

Change:

using JdeScoping.DataAccess.Interfaces;

To:

using JdeScoping.Core.Interfaces;

Also ensure the registration uses Core interface:

services.AddScoped<ILotFinderRepository, LotFinderRepository>();

This should already be correct since it registers by interface type.


Task 2.6: Update LotFinderRepository to use Core Interface

Files:

  • Modify: NEW/src/JdeScoping.DataAccess/Repositories/LotFinderRepository.cs
  • Modify: NEW/src/JdeScoping.DataAccess/Repositories/LotFinderRepository.Lookups.cs
  • Modify: NEW/src/JdeScoping.DataAccess/Repositories/LotFinderRepository.DataSync.cs
  • Modify: NEW/src/JdeScoping.DataAccess/Repositories/LotFinderRepository.SearchManagement.cs

Step 1: Update each file's using/namespace

In each LotFinderRepository*.cs file, change:

using JdeScoping.DataAccess.Interfaces;

To:

using JdeScoping.Core.Interfaces;

Or add this using if not present.


Task 2.7: Build and verify Phase 2

Step 1: Build the solution

Run:

cd /Users/dohertj2/Desktop/JdeScopingTool/NEW && dotnet build

Expected: Build succeeded.

Step 2: Commit Phase 2

Run:

cd /Users/dohertj2/Desktop/JdeScopingTool/NEW && git add -A && git commit -m "refactor: consolidate ILotFinderRepository interfaces into Core"

Phase 3: Merge SearchProcessing into DataAccess

Task 3.1: Create target directories in DataAccess

Step 1: Create directories

Run:

mkdir -p /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.DataAccess/Services
mkdir -p /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.DataAccess/FilterHandlers
mkdir -p /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.DataAccess/QueryBuilders
mkdir -p /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.DataAccess/Models/FilterEntries
mkdir -p /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.DataAccess/Models/Results
mkdir -p /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.DataAccess/Attributes

Task 3.2: Move SearchProcessing files to DataAccess

Step 1: Move all files

Run:

# Services
cp /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.SearchProcessing/Services/*.cs /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.DataAccess/Services/

# FilterHandlers
cp /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.SearchProcessing/FilterHandlers/*.cs /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.DataAccess/FilterHandlers/

# QueryBuilders
cp /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.SearchProcessing/QueryBuilders/*.cs /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.DataAccess/QueryBuilders/

# Models
cp /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.SearchProcessing/Models/*.cs /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.DataAccess/Models/ 2>/dev/null || true
cp /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.SearchProcessing/Models/FilterEntries/*.cs /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.DataAccess/Models/FilterEntries/
cp /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.SearchProcessing/Models/Results/*.cs /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.DataAccess/Models/Results/

# Interfaces
cp /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.SearchProcessing/Interfaces/*.cs /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.DataAccess/Interfaces/

# Attributes
cp /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.SearchProcessing/Attributes/*.cs /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.DataAccess/Attributes/

# Extensions
cp /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.SearchProcessing/Extensions/*.cs /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.DataAccess/Extensions/

# Configuration
cp /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.SearchProcessing/Configuration/*.cs /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.DataAccess/Configuration/

Task 3.3: Update namespaces in moved files

Step 1: Update all namespaces

For each moved .cs file, change namespace from JdeScoping.SearchProcessing.* to JdeScoping.DataAccess.*.

Use find/replace in each file. Key patterns:

  • namespace JdeScoping.SearchProcessingnamespace JdeScoping.DataAccess
  • using JdeScoping.SearchProcessingusing JdeScoping.DataAccess

Task 3.4: Update DataAccess.csproj

Files:

  • Modify: NEW/src/JdeScoping.DataAccess/JdeScoping.DataAccess.csproj

Step 1: Add SqlKata package if not present

Check if SearchProcessing uses SqlKata and add to DataAccess.csproj:

<PackageReference Include="SqlKata" Version="3.0.0" />
<PackageReference Include="SqlKata.Execution" Version="3.0.0" />

Task 3.5: Update DataAccess ServiceCollectionExtensions

Files:

  • Modify: NEW/src/JdeScoping.DataAccess/Extensions/ServiceCollectionExtensions.cs

Step 1: Add SearchProcessing service registrations

Add to the AddDataAccess method:

// Search processing services
services.AddScoped<ISearchProcessor, SearchProcessor>();
services.AddScoped<ISearchQueryBuilder, SqlKataSearchQueryBuilder>();
services.AddScoped<IWorkOrderTraversalService, WorkOrderTraversalService>();

// Filter handlers
services.AddScoped<IFilterHandler, WorkOrderFilterHandler>();
services.AddScoped<IFilterHandler, ItemNumberFilterHandler>();
services.AddScoped<IFilterHandler, ProfitCenterFilterHandler>();
services.AddScoped<IFilterHandler, WorkCenterFilterHandler>();
services.AddScoped<IFilterHandler, OperatorFilterHandler>();
services.AddScoped<IFilterHandler, ComponentLotFilterHandler>();
services.AddScoped<IFilterHandler, ItemOperationMisFilterHandler>();
services.AddScoped<IFilterHandler, TimespanFilterHandler>();

Add required usings at top of file.


Task 3.6: Delete SearchProcessing project

Step 1: Remove project directory

Run:

rm -rf /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.SearchProcessing

Task 3.7: Update solution file

Files:

  • Modify: NEW/JdeScoping.slnx

Step 1: Remove SearchProcessing from solution

Edit NEW/JdeScoping.slnx, remove the line:

<Project Path="src/JdeScoping.SearchProcessing/JdeScoping.SearchProcessing.csproj" />

Task 3.8: Update Host references

Files:

  • Modify: NEW/src/JdeScoping.Host/JdeScoping.Host.csproj
  • Modify: NEW/src/JdeScoping.Host/Program.cs

Step 1: Remove SearchProcessing reference from Host.csproj

Remove the ProjectReference to SearchProcessing.

Step 2: Update Program.cs

Remove:

using JdeScoping.SearchProcessing;

Remove the line:

.AddSearchProcessing(builder.Configuration) // 4. Search execution

The search processing services are now registered via AddDataAccess.


Task 3.9: Move SearchProcessing tests to DataAccess.Tests

Step 1: Create directories in DataAccess.Tests

Run:

mkdir -p /Users/dohertj2/Desktop/JdeScopingTool/NEW/tests/JdeScoping.DataAccess.Tests/Services
mkdir -p /Users/dohertj2/Desktop/JdeScopingTool/NEW/tests/JdeScoping.DataAccess.Tests/FilterHandlers
mkdir -p /Users/dohertj2/Desktop/JdeScopingTool/NEW/tests/JdeScoping.DataAccess.Tests/QueryBuilders
mkdir -p /Users/dohertj2/Desktop/JdeScopingTool/NEW/tests/JdeScoping.DataAccess.Tests/Models
mkdir -p /Users/dohertj2/Desktop/JdeScopingTool/NEW/tests/JdeScoping.DataAccess.Tests/Extensions

Step 2: Move test files

Run:

cp /Users/dohertj2/Desktop/JdeScopingTool/NEW/tests/JdeScoping.SearchProcessing.Tests/FilterHandlers/*.cs /Users/dohertj2/Desktop/JdeScopingTool/NEW/tests/JdeScoping.DataAccess.Tests/FilterHandlers/
cp /Users/dohertj2/Desktop/JdeScopingTool/NEW/tests/JdeScoping.SearchProcessing.Tests/Models/*.cs /Users/dohertj2/Desktop/JdeScopingTool/NEW/tests/JdeScoping.DataAccess.Tests/Models/
cp /Users/dohertj2/Desktop/JdeScopingTool/NEW/tests/JdeScoping.SearchProcessing.Tests/Extensions/*.cs /Users/dohertj2/Desktop/JdeScopingTool/NEW/tests/JdeScoping.DataAccess.Tests/Extensions/
cp /Users/dohertj2/Desktop/JdeScopingTool/NEW/tests/JdeScoping.SearchProcessing.Tests/QueryBuilders/*.cs /Users/dohertj2/Desktop/JdeScopingTool/NEW/tests/JdeScoping.DataAccess.Tests/QueryBuilders/

Step 3: Update namespaces in test files

Change JdeScoping.SearchProcessing.Tests to JdeScoping.DataAccess.Tests in all moved test files.


Task 3.10: Delete SearchProcessing.Tests project

Step 1: Remove test project directory

Run:

rm -rf /Users/dohertj2/Desktop/JdeScopingTool/NEW/tests/JdeScoping.SearchProcessing.Tests

Step 2: Update solution file

Remove from NEW/JdeScoping.slnx:

<Project Path="tests/JdeScoping.SearchProcessing.Tests/JdeScoping.SearchProcessing.Tests.csproj" />

Task 3.11: Build and verify Phase 3

Step 1: Build the solution

Run:

cd /Users/dohertj2/Desktop/JdeScopingTool/NEW && dotnet build

Expected: Build succeeded.

Step 2: Run tests

Run:

cd /Users/dohertj2/Desktop/JdeScopingTool/NEW && dotnet test

Expected: All tests pass.

Step 3: Commit Phase 3

Run:

cd /Users/dohertj2/Desktop/JdeScopingTool/NEW && git add -A && git commit -m "refactor: merge SearchProcessing into DataAccess"

Phase 4: Clean up Core Package References

Task 4.1: Remove infrastructure packages from Core.csproj

Files:

  • Modify: NEW/src/JdeScoping.Core/JdeScoping.Core.csproj

Step 1: Edit Core.csproj

Remove these PackageReferences:

<PackageReference Include="ClosedXML" Version="0.105.0" />
<PackageReference Include="Dapper" Version="2.1.66" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="6.1.3" />
<PackageReference Include="Oracle.ManagedDataAccess.Core" Version="23.26.0" />
<PackageReference Include="System.DirectoryServices.Protocols" Version="10.0.1" />

Keep:

<PackageReference Include="Cronos" Version="0.11.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="10.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="10.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.1" />
<PackageReference Include="Microsoft.Extensions.Options" Version="10.0.1" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="10.0.1" />

Task 4.2: Delete remaining DI extensions from Core

Files:

  • Delete: NEW/src/JdeScoping.Core/Extensions/DataSyncServiceExtensions.cs
  • Delete: NEW/src/JdeScoping.Core/Extensions/ExcelExportServiceExtensions.cs
  • Delete: NEW/src/JdeScoping.Core/Extensions/SearchProcessingServiceExtensions.cs

Step 1: Delete the files

Run:

rm /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.Core/Extensions/DataSyncServiceExtensions.cs
rm /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.Core/Extensions/ExcelExportServiceExtensions.cs
rm /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.Core/Extensions/SearchProcessingServiceExtensions.cs

Task 4.3: Build and verify Phase 4

Step 1: Build the solution

Run:

cd /Users/dohertj2/Desktop/JdeScopingTool/NEW && dotnet build

Expected: Build succeeded.

Step 2: Commit Phase 4

Run:

cd /Users/dohertj2/Desktop/JdeScopingTool/NEW && git add -A && git commit -m "refactor: remove infrastructure packages from Core"

Phase 5: Client References Core

Task 5.1: Add Core reference to Client

Files:

  • Modify: NEW/src/JdeScoping.Client/JdeScoping.Client.csproj

Step 1: Add ProjectReference

Add to Client.csproj:

<ItemGroup>
  <ProjectReference Include="..\JdeScoping.Core\JdeScoping.Core.csproj" />
</ItemGroup>

Task 5.2: Delete duplicate ViewModels from Client

Files:

  • Delete: NEW/src/JdeScoping.Client/Models/ItemViewModel.cs
  • Delete: NEW/src/JdeScoping.Client/Models/ProfitCenterViewModel.cs
  • Delete: NEW/src/JdeScoping.Client/Models/WorkCenterViewModel.cs
  • Delete: NEW/src/JdeScoping.Client/Models/WorkOrderViewModel.cs
  • Delete: NEW/src/JdeScoping.Client/Models/PartOperationViewModel.cs

Step 1: Delete duplicate files

Run:

rm /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.Client/Models/ItemViewModel.cs
rm /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.Client/Models/ProfitCenterViewModel.cs
rm /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.Client/Models/WorkCenterViewModel.cs
rm /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.Client/Models/WorkOrderViewModel.cs
rm /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.Client/Models/PartOperationViewModel.cs

Task 5.3: Update Client usings

Step 1: Find files using deleted ViewModels

Search for files referencing JdeScoping.Client.Models.ItemViewModel etc. and update to use JdeScoping.Core.ViewModels.

Update using statements in affected files:

using JdeScoping.Core.ViewModels;

Task 5.4: Build and verify Phase 5

Step 1: Build the solution

Run:

cd /Users/dohertj2/Desktop/JdeScopingTool/NEW && dotnet build

Expected: Build succeeded.

Step 2: Commit Phase 5

Run:

cd /Users/dohertj2/Desktop/JdeScopingTool/NEW && git add -A && git commit -m "refactor: Client references Core for shared ViewModels"

Phase 6: Excel Export Cleanup

Task 6.1: Delete duplicate Excel interface

Files:

  • Delete: NEW/src/JdeScoping.ExcelExport/Interfaces/IExcelExportService.cs

Step 1: Delete the file

Run:

rm /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.ExcelExport/Interfaces/IExcelExportService.cs
rmdir /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.ExcelExport/Interfaces 2>/dev/null || true

Task 6.2: Update ExcelExportService to implement Core.IExcelWriter

Files:

  • Modify: NEW/src/JdeScoping.ExcelExport/ExcelExportService.cs

Step 1: Update class declaration

Change to implement JdeScoping.Core.Interfaces.IExcelWriter instead of the local interface.

Add using:

using JdeScoping.Core.Interfaces;

Update class:

public class ExcelExportService : IExcelWriter

Step 2: Ensure method signature matches

The IExcelWriter interface has:

Task<byte[]> GenerateExcelAsync(int searchId, CancellationToken cancellationToken = default);

Update or alias the method as needed.


Task 6.3: Update ExcelExport ServiceCollectionExtensions

Files:

  • Modify: NEW/src/JdeScoping.ExcelExport/ServiceCollectionExtensions.cs

Step 1: Update registration

Change registration to use Core interface:

using JdeScoping.Core.Interfaces;

services.AddScoped<IExcelWriter, ExcelExportService>();

Task 6.4: Build and verify Phase 6

Step 1: Build the solution

Run:

cd /Users/dohertj2/Desktop/JdeScopingTool/NEW && dotnet build

Expected: Build succeeded.

Step 2: Run all tests

Run:

cd /Users/dohertj2/Desktop/JdeScopingTool/NEW && dotnet test

Expected: All tests pass.

Step 3: Commit Phase 6

Run:

cd /Users/dohertj2/Desktop/JdeScopingTool/NEW && git add -A && git commit -m "refactor: unify Excel export to use Core.IExcelWriter"

Phase 7: Final Verification

Task 7.1: Full build verification

Step 1: Clean and rebuild

Run:

cd /Users/dohertj2/Desktop/JdeScopingTool/NEW && dotnet clean && dotnet build

Expected: Build succeeded with no warnings.


Task 7.2: Run all tests

Step 1: Execute test suite

Run:

cd /Users/dohertj2/Desktop/JdeScopingTool/NEW && dotnet test --verbosity normal

Expected: All tests pass.


Task 7.3: Verify Core has no infrastructure packages

Step 1: Check Core.csproj

Run:

grep -E "(Dapper|Oracle|SqlClient|DirectoryServices|ClosedXML)" /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/JdeScoping.Core/JdeScoping.Core.csproj

Expected: No output (no infrastructure packages).


Task 7.4: Verify dependency direction

Step 1: Check that only Host references Infrastructure

Run:

grep -l "JdeScoping.Infrastructure" /Users/dohertj2/Desktop/JdeScopingTool/NEW/src/*/*.csproj

Expected: Only JdeScoping.Host.csproj


Task 7.5: Final commit

Step 1: Create summary commit

Run:

cd /Users/dohertj2/Desktop/JdeScopingTool/NEW && git add -A && git commit -m "refactor: complete Clean Architecture compliance

- Created Infrastructure project for Oracle/LDAP implementations
- Consolidated ILotFinderRepository interfaces into Core
- Merged SearchProcessing into DataAccess
- Removed infrastructure packages from Core
- Client now references Core for shared ViewModels
- Unified Excel export to use Core.IExcelWriter"

Summary

Total Tasks: 38 tasks across 7 phases

Phase 1: Create Infrastructure project (12 tasks) Phase 2: Consolidate interfaces (7 tasks) Phase 3: Merge SearchProcessing (11 tasks) Phase 4: Clean Core packages (3 tasks) Phase 5: Client references Core (4 tasks) Phase 6: Excel export cleanup (4 tasks) Phase 7: Final verification (5 tasks)