feat(News): refactor news service and add sentiment tracking

This commit is contained in:
2026-08-09 21:01:41 +02:00
parent 605e41cfeb
commit aff831cf58
390 changed files with 115094 additions and 9 deletions
+174
View File
@@ -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("20260801073336_Init")]
partial class Init
{
/// <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,128 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace FinlyticNews.Migrations
{
/// <inheritdoc />
public partial class Init : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ArticleSources",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Source = table.Column<string>(type: "text", nullable: false),
Name = table.Column<string>(type: "text", nullable: false),
Type = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ArticleSources", x => x.Id);
});
migrationBuilder.CreateTable(
name: "NewsArticles",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Title = table.Column<string>(type: "text", nullable: false),
Author = table.Column<string>(type: "text", nullable: true),
Summary = table.Column<string>(type: "text", nullable: true),
ContentRaw = table.Column<string>(type: "text", nullable: false),
Language = table.Column<string>(type: "text", nullable: true),
SourceUrl = table.Column<string>(type: "text", nullable: false),
ScrapedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
PublishedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
Status = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_NewsArticles", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Settings",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
PollingFrequencyMinutes = table.Column<int>(type: "integer", nullable: false),
ArticleRetentionDays = table.Column<int>(type: "integer", nullable: false),
DefaultPageSize = table.Column<int>(type: "integer", nullable: false),
ScrapingIntervalMinutes = table.Column<int>(type: "integer", nullable: false),
N8nWebhookUrl = table.Column<string>(type: "text", nullable: false),
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Settings", x => x.Id);
});
migrationBuilder.CreateTable(
name: "MatchedAssets",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
NewsArticleId = table.Column<Guid>(type: "uuid", nullable: false),
Isin = table.Column<string>(type: "text", nullable: false),
Name = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_MatchedAssets", x => x.Id);
table.ForeignKey(
name: "FK_MatchedAssets_NewsArticles_NewsArticleId",
column: x => x.NewsArticleId,
principalTable: "NewsArticles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_MatchedAssets_Isin",
table: "MatchedAssets",
column: "Isin");
migrationBuilder.CreateIndex(
name: "IX_MatchedAssets_NewsArticleId",
table: "MatchedAssets",
column: "NewsArticleId");
migrationBuilder.CreateIndex(
name: "IX_NewsArticles_PublishedAt_ScrapedAt",
table: "NewsArticles",
columns: new[] { "PublishedAt", "ScrapedAt" });
migrationBuilder.CreateIndex(
name: "IX_NewsArticles_SourceUrl",
table: "NewsArticles",
column: "SourceUrl",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_NewsArticles_Status",
table: "NewsArticles",
column: "Status");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ArticleSources");
migrationBuilder.DropTable(
name: "MatchedAssets");
migrationBuilder.DropTable(
name: "Settings");
migrationBuilder.DropTable(
name: "NewsArticles");
}
}
}
@@ -0,0 +1,171 @@
// <auto-generated />
using System;
using FinlyticNews.Database;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace FinlyticNews.Migrations
{
[DbContext(typeof(NewsDbContext))]
partial class NewsDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(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
}
}
}