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

This commit is contained in:
2026-08-15 21:30:19 +02:00
parent 0d370d09e7
commit 57554a9582
9 changed files with 588 additions and 63 deletions
+17 -2
View File
@@ -1,10 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using FinlyticCore.Database;
using FinlyticCore.Entities.Settings;
using FinlyticTrades.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
namespace FinlyticTrades.Database;
public class TradesDbContext : DbContext
public class TradesDbContext : DbContext, ISettingsDbContext
{
public TradesDbContext(DbContextOptions<TradesDbContext> options) : base(options) { }
@@ -20,7 +25,7 @@ public class TradesDbContext : DbContext
modelBuilder.Entity<SettingEntity>(entity =>
{
entity.HasKey(e => e.Id);
entity.HasIndex(e => e.Key);
entity.HasIndex(e => e.Key).IsUnique();
});
var stringListConverter =
@@ -57,3 +62,13 @@ public class TradesDbContext : DbContext
});
}
}
public class TradesDbContextFactory : IDesignTimeDbContextFactory<TradesDbContext>
{
public TradesDbContext CreateDbContext(string[] args)
{
var optionsBuilder = new DbContextOptionsBuilder<TradesDbContext>();
optionsBuilder.UseNpgsql("Host=localhost;Database=trades;Username=postgres;Password=postgres");
return new TradesDbContext(optionsBuilder.Options);
}
}