# Project plan — shipment_document_system

Evidence date: 2026-10-04.

Source repository: `git@bitbucket.org:overdrive/shipment_document_system.git`.

Inspected revision: `main` at `6f61b57` (2026-04-24, "Security Enhancements"). `origin/HEAD` points at `main`. No other remote branches were present.

This plan describes what the repository contains. It does not decide what the product should become.

The onboarding issue recorded a scan-host snapshot whose tip was `fc6f1b5` (2025-08-28, "Route updates"). That commit is the parent of `6f61b57`. The scan host was behind `origin/main`. Documentation here follows the fetched tip.

There is no prior Silicon Ark directory for this project. The source repository has no `README`.

## Product

The solution folder is `rgbc_sds`. The layout title is **RGBC - Shipment Document System**. The header reads **Logistics and Supply Chain** and shows `wwwroot/images/rgbc_logo.jpg`.

What the letters RGBC expand to is **Unknown / Requires Confirmation**. The same is true for SACD, VOC, DRO, and GRV, which appear only as field and document labels.

The product records a shipment (indent) and the checklist documents that travel with it. Shipment rows live in SQL Server. Document files are stored in a SharePoint document library under `/Shipment Checklist/{indent number}/`, reached through Microsoft Graph.

Provenance: **Implemented** in views, `ShipmentController`, `SharePointService`, and the EF model. No product brief was found in the repository.

## Branch reality

History starts at `75a0eea` (2024-05-03, "Initial commit") and `e48cf20` (2024-05-13, "initial committ"). Activity is concentrated in May–August 2024, then August 2025 (import, export, route updates), then one commit in April 2026.

| Commit | Date | Subject |
|---|---|---|
| `e48cf20` | 2024-05-13 | initial committ |
| `4848f55` | 2024-06-06 | Implemented SharePoint integration |
| `77b1009` | 2024-07-08 | .net 8.0 upgrade; login screen style amendment |
| `5d06fdb` | 2024-08-29 | documents heading rename; container number and mbl number alphanumeric |
| `cf1e648` | 2025-08-21 | Export functionality done |
| `7edc72d` | 2025-08-25 | bulk upload functionality added |
| `00cf5a6` | 2025-08-26 | Updated "Offloading Port" Shipment import validation |
| `fc6f1b5` | 2025-08-28 | Route updates |
| `6f61b57` | 2026-04-24 | Security Enhancements |

`6f61b57` removes SharePoint settings from `appsettings.json`, adds `.env.example` and `SecureConfig`, and adjusts several views. Connection string and Graph credentials are no longer in `appsettings.json`.

## Scope in the repository

In scope, as implemented:

- Sign-in screen that reads `User.Identity.Name` and looks that value up in `mstUser.strDomainLogin`.
- Shipment list, filter, create, update, submit, cancel, Excel export.
- Sixteen checklist document slots per shipment, with SharePoint upload, preview, delete, and folder rename when the indent number changes.
- Supplier list, filter, create, update, and soft delete.
- Excel import: template download, upload, staging, validation, preview, error list, execute, cancel, history.
- User maintenance views. The service methods that would read and write users are commented out. The Users nav link is commented out.

Out of scope in this tree:

- Deployment manifests, hosting project, IIS site definition, or Docker files.
- Automated tests.
- A written product requirements document inside the source repository.
- Active Directory lookup. `UserService.ValidateUser` contains a TODO comment and does not call a directory.

`sonar-project.properties` and `sonarqube_scan.bat` were named in the onboarding snapshot. They are not tracked in git history. The SonarQube project key lives in `bitbucket-pipelines.yml`.

## System shape

Three projects, numbered in the folder names:

| Project | Role |
|---|---|
| `rgbc_sds/1. website/rgbc_sds.website` | ASP.NET Core MVC site, .NET 8 |
| `rgbc_sds/2. services/rgbc_sds.services` | Shipment, supplier, user, import, and SharePoint services |
| `rgbc_sds/3. dal/rgbc_sds.dal` | EF Core `rgbc_sdsContext` and entities |

`sql files/` holds four scripts for the import tables, indexes, stored procedures, and views. The C# import path uses EF against those tables. No C# call to the stored procedures or views was found.

## Major components

1. **Account** — `AccountController`. Login posts to `account/login`. Logout renders the login view.
2. **Shipments** — `ShipmentController` and `ShipmentService`. List, filter, add, update, submit, cancel, delete a document slot, export.
3. **Import** — `ImportController` and `ImportService`. Session, staging rows, error log.
4. **Suppliers** — `SupplierController` and `SupplierService`.
5. **SharePoint** — `SharePointService` (Microsoft Graph, client-credentials). `SharePointController.UploadFile` does not call the service. `FileUploadService` is constructed on the shipment controller and has no call site.
6. **Users** — `UserController` views exist. Persistence against a `users` table is commented out. Live identity is `mstUser`.

## Milestones visible in git

These are commit subjects, not an approved plan.

| When | What landed |
|---|---|
| 2024-05 | Initial application, login styling, user maintenance screens |
| 2024-06 | SharePoint upload, multi-file upload, view and delete, pipeline file |
| 2024-07 | .NET 8 target, logging, validation, indent duplicate checks, file rename |
| 2024-08 | Document heading rename; container number and M/BL left alphanumeric |
| 2025-08 | Excel export, bulk import with staging and history, port validation, route updates |
| 2026-04 | Secrets moved out of `appsettings.json` into environment variables |

No milestone after 2026-04-24 is in the repository. Nothing in the tree is marked as a future release.

## Known dependencies

- .NET 8 (`net8.0` on all three projects).
- ASP.NET Core MVC, Razor runtime compilation 7.0.18, session.
- EF Core SQL Server 7.0.18 / 7.0.20.
- EPPlus 7.0.9, license context set to `NonCommercial` in code.
- Microsoft.Graph 4.54.0 and Azure.Identity 1.11.4.
- Microsoft.Identity.Client via the Graph stack, for the SharePoint token.
- System.DirectoryServices 8.0.0 is referenced by the website project. No directory call was found.
- jQuery, jQuery UI, Bootstrap, and Font Awesome, from `wwwroot` and CDNs in `_Layout.cshtml`.
- SQL Server database. Name and server are **Unknown**. The connection string is the environment variable `RGBC_SDS_CONNECTION_STRING`.
- Microsoft Entra ID app registration and a SharePoint site. Identifiers are environment variables. Values are not in git.
- Bitbucket Pipelines image `mcr.microsoft.com/dotnet/sdk:7.0` running a SonarQube scan. The image major version and the project target framework differ.

## Current project status

**Implemented and present on `main`.** The site can list and edit shipments, talk to SharePoint, and import or export spreadsheets, provided the host supplies the connection string and Graph settings and the SQL tables exist.

**Not established from this repository:**

- Where the site is hosted, and the public URL.
- Whether Windows authentication is enabled on that host. `launchSettings.json` sets `windowsAuthentication` to false and `anonymousAuthentication` to true for IIS Express.
- Whether the import SQL scripts have been applied.
- Whether the Bitbucket pipeline succeeds. The scanner image is the .NET 7 SDK while the projects target `net8.0`.
- Whether EPPlus non-commercial licensing matches how RGBC uses the application.
- Who the business owner is, and which environment is production.

## Implementation notes that affect the plan

These are recorded so later work does not treat them as settled product decisions. Detail is in `business-rules.md` and `prd.md`.

- Login treats any non-null `UserModel` as success. `ValidateUser` returns a new empty model when the domain login is missing, and that object is not null. The controller still redirects to the shipment list.
- No `[Authorize]` filter and no session check were found on controllers. Role differences are mostly in the Razor views.
- The conventional `{controller}/{action}` route is commented out. `HomeController`, `UserController`, and `SharePointController` actions have no `[Route]`.
- Shipment status strings in the database (`SAVED`, `SUBMITTED`, `CANCELLED`) do not match `ShipmentStatusEnum` (`Saved`, `Complete`, `Cancelled`) or the unused `ShipmentService.SubmitShipment` method, which writes `COMPLETED`.
- Import mode is stored on the session. `ExecuteImportAsync` does not branch on it. It updates when the indent exists and inserts when it does not.
- User add, update, delete, and list in `UserService` are commented out and return empty or a hard-coded success.
