feat(technical,sentiment,news): add pending migrations and DbContext updates

This commit is contained in:
2026-08-14 23:56:36 +02:00
parent c496651dd1
commit 5c4b3165ba
8 changed files with 476 additions and 3 deletions
@@ -0,0 +1,174 @@
// <auto-generated />
using System;
using FinlyticNews.Database;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace FinlyticNews.Migrations
{
[DbContext(typeof(NewsDbContext))]
[Migration("20260813202646_CheckPendingNews")]
partial class CheckPendingNews
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.9")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("FinlyticNews.Entities.ArticleSourceEntity", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Source")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArticleSources");
});
modelBuilder.Entity("FinlyticNews.Entities.MatchedAssetEntity", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Isin")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("NewsArticleId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("Isin");
b.HasIndex("NewsArticleId");
b.ToTable("MatchedAssets");
});
modelBuilder.Entity("FinlyticNews.Entities.NewsArticleEntity", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Author")
.HasColumnType("text");
b.Property<string>("ContentRaw")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Language")
.HasColumnType("text");
b.Property<DateTime>("PublishedAt")
.HasColumnType("timestamp with time zone");
b.Property<DateTime>("ScrapedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("SourceUrl")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Status")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Summary")
.HasColumnType("text");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("SourceUrl")
.IsUnique();
b.HasIndex("Status");
b.HasIndex("PublishedAt", "ScrapedAt");
b.ToTable("NewsArticles");
});
modelBuilder.Entity("FinlyticNews.Entities.NewsSettingsEntity", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<int>("ArticleRetentionDays")
.HasColumnType("integer");
b.Property<int>("DefaultPageSize")
.HasColumnType("integer");
b.Property<string>("N8nWebhookUrl")
.IsRequired()
.HasColumnType("text");
b.Property<int>("PollingFrequencyMinutes")
.HasColumnType("integer");
b.Property<int>("ScrapingIntervalMinutes")
.HasColumnType("integer");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.ToTable("Settings");
});
modelBuilder.Entity("FinlyticNews.Entities.MatchedAssetEntity", b =>
{
b.HasOne("FinlyticNews.Entities.NewsArticleEntity", "NewsArticle")
.WithMany("MatchedAssets")
.HasForeignKey("NewsArticleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("NewsArticle");
});
modelBuilder.Entity("FinlyticNews.Entities.NewsArticleEntity", b =>
{
b.Navigation("MatchedAssets");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace FinlyticNews.Migrations
{
/// <inheritdoc />
public partial class CheckPendingNews : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}
@@ -0,0 +1,63 @@
// <auto-generated />
using System;
using FinlyticSentiment.Database;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace FinlyticSentiment.Migrations
{
[DbContext(typeof(SentimentDbContext))]
[Migration("20260813202634_CheckPendingSentiment")]
partial class CheckPendingSentiment
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.9")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("FinlyticSentiment.Entities.SentimentSettingsEntity", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("EnglishWebhookUrl")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("character varying(500)");
b.Property<string>("GermanWebhookUrl")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("character varying(500)");
b.Property<int>("MaxBatchSize")
.HasColumnType("integer");
b.Property<double>("MinConfidenceScore")
.HasColumnType("double precision");
b.Property<int>("SweepIntervalMinutes")
.HasColumnType("integer");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.ToTable("sentiment_settings", (string)null);
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace FinlyticSentiment.Migrations
{
/// <inheritdoc />
public partial class CheckPendingSentiment : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}
@@ -1,3 +1,4 @@
using FinlyticCore.Entities.Settings;
using FinlyticTechnicalAnalysis.Entities;
using Microsoft.EntityFrameworkCore;
@@ -9,6 +10,7 @@ public class TechnicalAnalysisDbContext : DbContext
{
}
public DbSet<SettingEntity> DynamicSettings => Set<SettingEntity>();
public DbSet<MarketCandleEntity> MarketCandles => Set<MarketCandleEntity>();
public DbSet<MacroDataEntity> MacroData => Set<MacroDataEntity>();
public DbSet<CachedAnalysisEntity> CachedAnalyses => Set<CachedAnalysisEntity>();
@@ -18,6 +20,12 @@ public class TechnicalAnalysisDbContext : DbContext
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<SettingEntity>(entity =>
{
entity.HasKey(e => e.Id);
entity.HasIndex(e => e.Key);
});
modelBuilder.Entity<MarketCandleEntity>()
.HasIndex(c => new { c.Symbol, c.Interval, c.Timestamp })
.IsUnique();
@@ -0,0 +1,162 @@
// <auto-generated />
using System;
using FinlyticTechnicalAnalysis.Database;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace FinlyticTechnicalAnalysis.Migrations
{
[DbContext(typeof(TechnicalAnalysisDbContext))]
[Migration("20260813202624_CheckPendingTechnicalAnalysis")]
partial class CheckPendingTechnicalAnalysis
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.9")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("FinlyticTechnicalAnalysis.Entities.CachedAnalysisEntity", b =>
{
b.Property<string>("Isin")
.HasMaxLength(20)
.HasColumnType("character varying(20)");
b.Property<string>("AnalysisJson")
.IsRequired()
.HasColumnType("jsonb");
b.Property<DateTime>("CalculatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Ticker")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("character varying(20)");
b.HasKey("Isin");
b.HasIndex("Isin");
b.ToTable("CachedAnalyses");
});
modelBuilder.Entity("FinlyticTechnicalAnalysis.Entities.MacroDataEntity", b =>
{
b.Property<string>("Symbol")
.HasMaxLength(20)
.HasColumnType("character varying(20)");
b.Property<DateTime>("LastUpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property<decimal>("PreviousClose")
.HasColumnType("decimal(18, 6)");
b.Property<string>("TrendState")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<decimal>("Value")
.HasColumnType("decimal(18, 6)");
b.HasKey("Symbol");
b.ToTable("MacroData");
});
modelBuilder.Entity("FinlyticTechnicalAnalysis.Entities.MarketCandleEntity", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<decimal?>("Ask")
.HasColumnType("decimal(18, 6)");
b.Property<decimal?>("Bid")
.HasColumnType("decimal(18, 6)");
b.Property<decimal>("Close")
.HasColumnType("decimal(18, 6)");
b.Property<decimal>("High")
.HasColumnType("decimal(18, 6)");
b.Property<string>("Interval")
.IsRequired()
.HasMaxLength(10)
.HasColumnType("character varying(10)");
b.Property<decimal>("Low")
.HasColumnType("decimal(18, 6)");
b.Property<decimal>("Open")
.HasColumnType("decimal(18, 6)");
b.Property<string>("Symbol")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("character varying(20)");
b.Property<DateTime>("Timestamp")
.HasColumnType("timestamp with time zone");
b.Property<long>("Volume")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("Symbol", "Interval", "Timestamp")
.IsUnique();
b.ToTable("MarketCandles");
});
modelBuilder.Entity("FinlyticTechnicalAnalysis.Entities.TaSettingsEntity", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<int>("EmaShortPeriod")
.HasColumnType("integer");
b.Property<double>("RsiOverboughtLimit")
.HasColumnType("double precision");
b.Property<double>("RsiOversoldLimit")
.HasColumnType("double precision");
b.Property<int>("SmaLongPeriod")
.HasColumnType("integer");
b.Property<int>("SmaMediumPeriod")
.HasColumnType("integer");
b.Property<double>("SupertrendMultiplier")
.HasColumnType("double precision");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.ToTable("Settings");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace FinlyticTechnicalAnalysis.Migrations
{
/// <inheritdoc />
public partial class CheckPendingTechnicalAnalysis : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}
+3 -3
View File
@@ -30,10 +30,10 @@ builder.Services.AddSingleton<ITradeRepublicService, TradeRepublicService>();
// Register Technical Analysis Services
builder.Services.AddSingleton<ITechnicalAnalysisCalculator, TechnicalAnalysisCalculator>();
builder.Services.AddSingleton<ITechnicalAnalysisDbService, TechnicalAnalysisDbService>();
builder.Services.AddTransient<ITechnicalAnalysisDbService, TechnicalAnalysisDbService>();
builder.Services.AddScoped<ISettingsDbService, SettingsDbService>();
builder.Services.AddScoped<IYahooMarketDataScraper, YahooMarketDataScraper>();
builder.Services.AddScoped<YahooFinanceClient>();
builder.Services.AddTransient<IYahooMarketDataScraper, YahooMarketDataScraper>();
builder.Services.AddSingleton<YahooFinanceClient>();
// Register MQTT Client (as a Hosted Service)
builder.Services.AddHostedService<TAMqttClient>();