8524631508
- Replaced console app with .NET 8 Blazor Server architecture - Added EF Core SQLite database (trafag_exporter.db) with auto-seed data - Models: HanaServer, Site, SharePointConfig, ExportSettings, ExportLog, SalesRecord - Services: HanaQueryService (with configurable dateFilter), ExcelExportService, SharePointUploadService, ExportOrchestrationService (with live status events), TimerBackgroundService (scheduled daily export) - MudBlazor UI pages: Dashboard (export status + manual trigger), Standorte (HANA server + site CRUD), Settings (SharePoint + timer config), Logs (filtered view) - SAP HANA queries unchanged (INV + CRN with exact SAP B1 table joins) - SharePoint upload via Microsoft Graph with app registration auth https://claude.ai/code/session_012heAXNMbbyxqYf2S2HrKLj
45 lines
1.3 KiB
C#
45 lines
1.3 KiB
C#
using Microsoft.EntityFrameworkCore;
|
|
using MudBlazor.Services;
|
|
using TrafagSalesExporter.Data;
|
|
using TrafagSalesExporter.Services;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
builder.Services.AddRazorComponents()
|
|
.AddInteractiveServerComponents();
|
|
|
|
builder.Services.AddMudServices();
|
|
|
|
builder.Services.AddDbContextFactory<AppDbContext>(options =>
|
|
options.UseSqlite("Data Source=trafag_exporter.db"));
|
|
|
|
builder.Services.AddSingleton<HanaQueryService>();
|
|
builder.Services.AddSingleton<ExcelExportService>();
|
|
builder.Services.AddSingleton<SharePointUploadService>();
|
|
builder.Services.AddSingleton<ExportOrchestrationService>();
|
|
builder.Services.AddSingleton<TimerBackgroundService>();
|
|
builder.Services.AddHostedService(sp => sp.GetRequiredService<TimerBackgroundService>());
|
|
|
|
var app = builder.Build();
|
|
|
|
using (var scope = app.Services.CreateScope())
|
|
{
|
|
var dbFactory = scope.ServiceProvider.GetRequiredService<IDbContextFactory<AppDbContext>>();
|
|
using var db = await dbFactory.CreateDbContextAsync();
|
|
await db.Database.EnsureCreatedAsync();
|
|
AppDbContext.SeedIfEmpty(db);
|
|
}
|
|
|
|
if (!app.Environment.IsDevelopment())
|
|
{
|
|
app.UseHsts();
|
|
}
|
|
|
|
app.UseStaticFiles();
|
|
app.UseAntiforgery();
|
|
|
|
app.MapRazorComponents<TrafagSalesExporter.Components.App>()
|
|
.AddInteractiveServerRenderMode();
|
|
|
|
app.Run();
|