feat(analyzer): dynamic settings, IFinlyticLogger, live log streaming, and EF migration

This commit is contained in:
2026-08-15 21:30:16 +02:00
parent 62e030e2cf
commit 0d370d09e7
13 changed files with 687 additions and 215 deletions
+14 -2
View File
@@ -1,10 +1,12 @@
using FinlyticAnalyzer.Entities;
using FinlyticCore.Database;
using FinlyticCore.Entities.Settings;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
namespace FinlyticAnalyzer.Database;
public class AnalyzerDbContext : DbContext
public class AnalyzerDbContext : DbContext, ISettingsDbContext
{
public AnalyzerDbContext(DbContextOptions<AnalyzerDbContext> options) : base(options) { }
@@ -20,7 +22,7 @@ public class AnalyzerDbContext : DbContext
modelBuilder.Entity<SettingEntity>(entity =>
{
entity.HasKey(e => e.Id);
entity.HasIndex(e => e.Key);
entity.HasIndex(e => e.Key).IsUnique();
});
modelBuilder.Entity<AnalysisEntity>(entity =>
@@ -39,3 +41,13 @@ public class AnalyzerDbContext : DbContext
});
}
}
public class AnalyzerDbContextFactory : IDesignTimeDbContextFactory<AnalyzerDbContext>
{
public AnalyzerDbContext CreateDbContext(string[] args)
{
var optionsBuilder = new DbContextOptionsBuilder<AnalyzerDbContext>();
optionsBuilder.UseNpgsql("Host=localhost;Database=analyzer;Username=postgres;Password=postgres");
return new AnalyzerDbContext(optionsBuilder.Options);
}
}