feat(Trades): refactor trades MQTT client and DTOs
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
using FinlyticTrades.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace FinlyticTrades.Database;
|
||||
|
||||
public class TradesDbContext : DbContext
|
||||
{
|
||||
public TradesDbContext(DbContextOptions<TradesDbContext> options) : base(options) { }
|
||||
|
||||
public DbSet<TradeEntity> Trades => Set<TradeEntity>();
|
||||
public DbSet<TradeHourlyUpdateEntity> TradeHourlyUpdates => Set<TradeHourlyUpdateEntity>();
|
||||
public DbSet<TradesSettingsEntity> Settings => Set<TradesSettingsEntity>();
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
base.OnModelCreating(modelBuilder);
|
||||
|
||||
modelBuilder.Entity<TradeEntity>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.TradeId).IsUnique();
|
||||
entity.HasIndex(e => e.AnalysisId);
|
||||
entity.HasIndex(e => e.EventId);
|
||||
entity.HasIndex(e => e.Status);
|
||||
entity.HasIndex(e => e.Sector);
|
||||
entity.HasIndex(e => e.Isin);
|
||||
entity.HasIndex(e => e.CreatedAt);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<TradeHourlyUpdateEntity>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.TradeId);
|
||||
entity.HasIndex(e => e.Timestamp);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user