feat(News): refactor news service and add sentiment tracking
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace FinlyticNews.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a news or feed source configuration retrieved from the database to discover article links.
|
||||
/// </summary>
|
||||
public class ArticleSourceEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the unique primary key identifier.
|
||||
/// </summary>
|
||||
[Key]
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the target URL or domain feed address (e.g., RSS XML URL or HTML listing URL).
|
||||
/// </summary>
|
||||
[Required]
|
||||
public string Source { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the human-readable display name of the news provider.
|
||||
/// </summary>
|
||||
[Required]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the adapter type keyword used to resolve the parsing adapter (e.g., "rss", "finanznachrichten").
|
||||
/// </summary>
|
||||
[Required]
|
||||
public string Type { get; set; } = string.Empty;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace FinlyticNews.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a specific financial asset class match linked to a news article.
|
||||
/// </summary>
|
||||
public class MatchedAssetEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the unique primary key identifier.
|
||||
/// </summary>
|
||||
[Key]
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the foreign key pointing to the associated news article.
|
||||
/// </summary>
|
||||
[Required]
|
||||
public Guid NewsArticleId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the navigation property for the associated news article.
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public NewsArticleEntity? NewsArticle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ISIN of the matched asset.
|
||||
/// </summary>
|
||||
[Required]
|
||||
public string Isin { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the matched asset name.
|
||||
/// </summary>
|
||||
[Required]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace FinlyticNews.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a news article record stored in the database, tracking its lifecycle status and classification details.
|
||||
/// </summary>
|
||||
public class NewsArticleEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the unique primary key identifier.
|
||||
/// </summary>
|
||||
[Key]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the title of the article.
|
||||
/// </summary>
|
||||
[Required]
|
||||
public string Title { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the author of the article.
|
||||
/// </summary>
|
||||
public string? Author { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a brief summary of the article content.
|
||||
/// </summary>
|
||||
public string? Summary { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the raw extracted text content.
|
||||
/// </summary>
|
||||
[Required]
|
||||
public string ContentRaw { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the language of the article.
|
||||
/// </summary>
|
||||
public string? Language { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the unique source URL of the article. Used for duplicate checking (idempotency).
|
||||
/// </summary>
|
||||
[Required]
|
||||
public string SourceUrl { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the local timestamp when the scraper processed this article.
|
||||
/// </summary>
|
||||
public DateTime ScrapedAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the original publication date of the article.
|
||||
/// </summary>
|
||||
public DateTime PublishedAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the processing lifecycle state (e.g., "Pending", "Processing", "Completed", "Analyzed", "Failed").
|
||||
/// </summary>
|
||||
[Required]
|
||||
public string Status { get; set; } = "Pending";
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the list of financial assets matched and associated with this news article.
|
||||
/// </summary>
|
||||
public List<MatchedAssetEntity> MatchedAssets { get; set; } = [];
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace FinlyticNews.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Entity representing global runtime settings for the FinlyticNews microservice.
|
||||
/// Persisted in PostgreSQL and updated dynamically via Admin Panel MQTT events.
|
||||
/// </summary>
|
||||
public class NewsSettingsEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the primary key for the settings row.
|
||||
/// </summary>
|
||||
[Key]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Frequency in minutes for polling RSS feed sources.
|
||||
/// </summary>
|
||||
public int PollingFrequencyMinutes { get; set; } = 15;
|
||||
|
||||
/// <summary>
|
||||
/// Article retention period in days before archival or cleanup.
|
||||
/// </summary>
|
||||
public int ArticleRetentionDays { get; set; } = 90;
|
||||
|
||||
/// <summary>
|
||||
/// Default page size for historical news API pagination queries.
|
||||
/// </summary>
|
||||
public int DefaultPageSize { get; set; } = 20;
|
||||
|
||||
/// <summary>
|
||||
/// Background scraper interval in minutes.
|
||||
/// </summary>
|
||||
public int ScrapingIntervalMinutes { get; set; } = 15;
|
||||
|
||||
/// <summary>
|
||||
/// Webhook URL for n8n AI article analysis.
|
||||
/// </summary>
|
||||
public string N8nWebhookUrl { get; set; } = "http://localhost:5678/webhook/finlytic-news";
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp of last modification.
|
||||
/// </summary>
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||
}
|
||||
Reference in New Issue
Block a user