using backend.Auth; using backend.Data; using Microsoft.EntityFrameworkCore; var builder = WebApplication.CreateBuilder(args); builder.Services.AddDbContext(opt => opt.UseSqlite(builder.Configuration.GetConnectionString("Default"))); builder.Services.AddAppIdentity(); builder.Services.AddAuthorization(); var app = builder.Build(); using (var scope = app.Services.CreateScope()) { var sp = scope.ServiceProvider; var db = sp.GetRequiredService(); db.Database.Migrate(); await IdentitySetup.SeedRolesAsync(sp); if (db.SystemSettings.Find(1) is null) { db.SystemSettings.Add(new backend.Settings.SystemSettings { Id = 1 }); await db.SaveChangesAsync(); } } app.UseAuthentication(); app.UseAuthorization(); app.MapAuthEndpoints(); app.MapGet("/health", () => Results.Ok(new { ok = true })); app.Run(); public partial class Program { }