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.
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
# Host Project
|
||||
|
||||
The `JdeScoping.Host` project is the main entry point - an ASP.NET Core application that runs as a Windows Service.
|
||||
|
||||
## Program.cs Configuration
|
||||
|
||||
```csharp
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
builder.Host.UseWindowsService(); // Run as Windows Service
|
||||
|
||||
// ASP.NET Core services
|
||||
builder.Services.AddControllersWithViews();
|
||||
builder.Services.AddRazorPages();
|
||||
builder.Services.AddSignalR();
|
||||
|
||||
// Background services
|
||||
builder.Services.AddHostedService<SearchProcessorService>();
|
||||
builder.Services.AddHostedService<DataSyncService>();
|
||||
|
||||
// Core dependencies (from JdeScoping.Core)
|
||||
builder.Services.AddScoped<ISearchRepository, SearchRepository>();
|
||||
builder.Services.AddScoped<ISearchService, SearchService>();
|
||||
builder.Services.AddScoped<IExcelExportService, ExcelExportService>();
|
||||
|
||||
// Data source registration (file-based for dev, Oracle for prod)
|
||||
var dataSourceOptions = builder.Configuration
|
||||
.GetSection("DataSource").Get<DataSourceOptions>();
|
||||
|
||||
if (dataSourceOptions?.UseFileDataSource == true)
|
||||
{
|
||||
builder.Services.AddScoped<IJdeDataSource, JdeFileDataSource>();
|
||||
builder.Services.AddScoped<ICmsDataSource, CmsFileDataSource>();
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.Services.AddScoped<IJdeDataSource, JdeOracleDataSource>();
|
||||
builder.Services.AddScoped<ICmsDataSource, CmsOracleDataSource>();
|
||||
}
|
||||
|
||||
// Auth registration (fake for dev, LDAP for prod)
|
||||
var authOptions = builder.Configuration
|
||||
.GetSection("Auth").Get<AuthOptions>();
|
||||
|
||||
if (authOptions?.UseFakeAuth == true)
|
||||
{
|
||||
builder.Services.AddScoped<IAuthService, FakeAuthService>();
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.Services.AddScoped<IAuthService, LdapAuthService>();
|
||||
}
|
||||
|
||||
// Configuration
|
||||
builder.Services.Configure<LdapOptions>(builder.Configuration.GetSection("Ldap"));
|
||||
builder.Services.Configure<DataSyncOptions>(builder.Configuration.GetSection("DataSync"));
|
||||
builder.Services.Configure<DataSourceOptions>(builder.Configuration.GetSection("DataSource"));
|
||||
builder.Services.Configure<AuthOptions>(builder.Configuration.GetSection("Auth"));
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
app.UseStaticFiles();
|
||||
app.UseRouting();
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
|
||||
app.MapRazorPages();
|
||||
app.MapControllers();
|
||||
app.MapHub<StatusHub>("/hubs/status");
|
||||
app.MapFallbackToFile("index.html");
|
||||
|
||||
app.Run();
|
||||
```
|
||||
|
||||
## Controllers
|
||||
|
||||
| Controller | Purpose |
|
||||
|------------|---------|
|
||||
| `SearchController` | Submit search, get results, download Excel |
|
||||
| `LookupController` | Autocomplete APIs for items, work centers, operators |
|
||||
| `AuthController` | Login/logout against LDAP |
|
||||
|
||||
## Hubs
|
||||
|
||||
| Hub | Purpose |
|
||||
|-----|---------|
|
||||
| `StatusHub` | Pushes search status updates to connected clients |
|
||||
|
||||
## Background Services
|
||||
|
||||
| Service | Purpose |
|
||||
|---------|---------|
|
||||
| `SearchProcessorService` | Polls for queued searches, executes them, generates Excel |
|
||||
| `DataSyncService` | Runs on schedule, syncs JDE/CMS data to local cache |
|
||||
|
||||
Background services use `IServiceScopeFactory` to create scopes for database access, avoiding scoped-in-singleton issues.
|
||||
|
||||
## Related Documentation
|
||||
|
||||
- [Solution Structure](./SolutionStructure.md)
|
||||
- [Data Flow](./DataFlow.md)
|
||||
- [Configuration](./Configuration.md)
|
||||
Reference in New Issue
Block a user