# WSUCFSL WebApi Migration Plan

Date: 2026-05-06
Owner: Luther review / Ethan coordination

## Goal
Move all WSUCFSL-related code out of the standalone `WebApi` project and into the renamed `WsuSa` solution directly. `WebApi` should not remain the host or wiring target for CFSL behavior.

## Current state
- `WebApi/` contains CFSL controllers, services, DTOs, options, DbContext, and migrations.
- `WsuSa.Web` is the long-term solution host and already owns the solution startup path.
- The solution should stop referencing `WebApi` once migration work begins.

## Recommended target layout

### Host / startup
- `WsuSa.Web/Program.cs`
- `WsuSa.Web/appsettings*.json`
- `WsuSa.Web/Properties/launchSettings.json`

### CFSL feature code
- `WsuSa.Web/Controllers/Cfsl/*`
- `WsuSa.Web/Services/Cfsl/*`
- `WsuSa.Web/Options/*`

### Shared DTOs / contracts
- `WsuSa.Shared/Contracts/Cfsl/*`
- `WsuSa.Shared/Contracts/Common/*`
- `WsuSa.Shared/Contracts/Portfolios/*`
- `WsuSa.Shared/Contracts/MorningBriefings/*`
- `WsuSa.Shared/Contracts/TaskMonitors/*`

### Persistence / database
- `WsuSa.Database/Contexts/*`
- `WsuSa.Database/Entities/*`
- `WsuSa.Database/Configurations/*`
- `WsuSa.Database/Migrations/*`

## Bundles that should move together
1. **CFSL bundle**
   - controllers
   - services
   - DTOs
   - options
   - DbContext
   - migrations

2. **Finance bundle**
   - portfolios, instruments, transactions, cash ledger
   - related entities, DTOs, controllers, EF configurations

3. **Briefings bundle**
   - morning briefings and inputs
   - related entities, DTOs, controllers, EF configurations

4. **Monitoring / audit bundle**
   - task monitors, events, working log, access log
   - related entities, DTOs, controllers, EF configurations

## Order of operations
1. Create/confirm target folders in the `WsuSa` projects.
2. Move pure contracts/DTOs first.
3. Move persistence models and DbContexts next.
4. Move CFSL services and options.
5. Merge controller wiring into `WsuSa.Web`.
6. Align configuration and connection strings in `WsuSa.Web`.
7. Verify the app boots without any `WebApi` dependency.
8. Remove `WebApi` from the solution.
9. Delete or archive the old `WebApi` project after the new code is verified.

## Risks
- EF Core version mismatch between `WebApi` and `WsuSa` projects.
- Migration history conflicts if DbContext names are changed carelessly.
- Hidden route or auth behavior differences between the old host and `WsuSa.Web`.

## Success criteria
- No `WebApi` project entry remains in the solution.
- All CFSL endpoints are hosted by `WsuSa.Web`.
- DbContexts and migrations live under `WsuSa.Database`.
- Shared contracts live in `WsuSa.Shared`.
- The repo no longer encourages wiring against `WebApi`.
