admin fixes

This commit is contained in:
dingo
2026-03-01 08:09:49 -05:00
parent 773fc6a349
commit 59af920479
+16
View File
@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.EntityFrameworkCore;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Identity;
@@ -141,11 +142,26 @@ app.MapRazorPages();
app.MapRazorComponents<App>()
.AddInteractiveServerRenderMode();
// ── Apply pending migrations ───────────────────────────────────────────────
await MigrateAllAsync(app);
// ── Seed roles and initial SuperAdmin ─────────────────────────────────────
await SeedAsync(app);
app.Run();
static async Task MigrateAllAsync(WebApplication app)
{
using var scope = app.Services.CreateScope();
var sp = scope.ServiceProvider;
await sp.GetRequiredService<SorIdentityDbContext>().Database.MigrateAsync();
await sp.GetRequiredService<CatalogDbContext>().Database.MigrateAsync();
await sp.GetRequiredService<CollectionDbContext>().Database.MigrateAsync();
await sp.GetRequiredService<BazaarDbContext>().Database.MigrateAsync();
await sp.GetRequiredService<ChatDbContext>().Database.MigrateAsync();
await sp.GetRequiredService<GameDbContext>().Database.MigrateAsync();
}
static async Task SeedAsync(WebApplication app)
{
using var scope = app.Services.CreateScope();