feat(Core): update DTOs and shared models
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace FinlyticCore.Dtos.News;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a news article discovered by a feed/page scanner, carrying parsed metadata such as title, summary, publication date, language, and associated ISINs.
|
||||
/// </summary>
|
||||
public record DiscoveredArticle(
|
||||
[property: JsonPropertyName("url")]
|
||||
string Url,
|
||||
[property: JsonPropertyName("isins")]
|
||||
List<string>? Isins = null,
|
||||
[property: JsonPropertyName("title")]
|
||||
string? Title = null,
|
||||
[property: JsonPropertyName("summary")]
|
||||
string? Summary = null,
|
||||
[property: JsonPropertyName("publishedAt")]
|
||||
DateTime? PublishedAt = null,
|
||||
[property: JsonPropertyName("language")]
|
||||
string? Language = null,
|
||||
[property: JsonPropertyName("sourceName")]
|
||||
string? SourceName = null
|
||||
);
|
||||
@@ -0,0 +1,22 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace FinlyticCore.Dtos.News;
|
||||
|
||||
/// <summary>
|
||||
/// Data transfer object representing a financial asset matched inside an article.
|
||||
/// </summary>
|
||||
public record MatchedAssetDto
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the matched asset.
|
||||
/// </summary>
|
||||
[JsonPropertyName("name")]
|
||||
public string Name { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ISIN (International Securities Identification Number) of the matched asset.
|
||||
/// </summary>
|
||||
[JsonPropertyName("isin")]
|
||||
public string Isin { get; init; } = string.Empty;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace FinlyticCore.Dtos.News;
|
||||
|
||||
/// <summary>
|
||||
/// Payload representing the pre-filtered asset configuration dispatched to n8n.
|
||||
/// </summary>
|
||||
public record FilteredAssetPayload(
|
||||
[property: JsonPropertyName("Name")] string Name,
|
||||
[property: JsonPropertyName("Isin")] string Isin
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Webhook payload structure dispatched to the n8n workflow.
|
||||
/// </summary>
|
||||
public record N8nRequestPayload(
|
||||
[property: JsonPropertyName("article")] string Article,
|
||||
[property: JsonPropertyName("filtered_assets")] List<FilteredAssetPayload> FilteredAssets
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Matched asset returned by the n8n AI workflow classification.
|
||||
/// </summary>
|
||||
public record N8nMatchedAssetPayload(
|
||||
[property: JsonPropertyName("ticker")] string? Ticker,
|
||||
[property: JsonPropertyName("name")] string Name,
|
||||
[property: JsonPropertyName("confidence_score")] double ConfidenceScore
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Enriched response payload returned by the n8n workflow webhook.
|
||||
/// </summary>
|
||||
public record N8nResponsePayload(
|
||||
[property: JsonPropertyName("title")] string Title,
|
||||
[property: JsonPropertyName("author")] string? Author,
|
||||
[property: JsonPropertyName("published_at")] string? PublishedAt,
|
||||
[property: JsonPropertyName("scraped_at")] string? ScrapedAt,
|
||||
[property: JsonPropertyName("source_url")] string SourceUrl,
|
||||
[property: JsonPropertyName("summary")] string? Summary,
|
||||
[property: JsonPropertyName("content_raw")] string ContentRaw,
|
||||
[property: JsonPropertyName("language")] string? Language,
|
||||
[property: JsonPropertyName("matched_assets")] List<N8nMatchedAssetPayload> MatchedAssets
|
||||
);
|
||||
@@ -0,0 +1,101 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using FinlyticCore.Dtos.Sentiment;
|
||||
|
||||
namespace FinlyticCore.Dtos.News;
|
||||
|
||||
/// <summary>
|
||||
/// Data transfer object representing a parsed and enriched news article with bundled sentiment metrics.
|
||||
/// </summary>
|
||||
public record NewsArticleDto
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the unique article identifier.
|
||||
/// </summary>
|
||||
[JsonPropertyName("id")]
|
||||
public Guid Id { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the title of the article.
|
||||
/// </summary>
|
||||
[JsonPropertyName("title")]
|
||||
public string Title { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the author of the article.
|
||||
/// </summary>
|
||||
[JsonPropertyName("author")]
|
||||
public string? Author { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a brief summary of the article content.
|
||||
/// </summary>
|
||||
[JsonPropertyName("summary")]
|
||||
public string? Summary { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the raw extracted text content of the article.
|
||||
/// </summary>
|
||||
[JsonPropertyName("contentRaw")]
|
||||
public string ContentRaw { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the language of the article (e.g. "en", "de").
|
||||
/// </summary>
|
||||
[JsonPropertyName("language")]
|
||||
public string? Language { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the unique source URL of the article.
|
||||
/// </summary>
|
||||
[JsonPropertyName("sourceUrl")]
|
||||
public string SourceUrl { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the timestamp when the article was scraped.
|
||||
/// </summary>
|
||||
[JsonPropertyName("scrapedAt")]
|
||||
public DateTime ScrapedAt { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the publication timestamp of the article.
|
||||
/// </summary>
|
||||
[JsonPropertyName("publishedAt")]
|
||||
public DateTime PublishedAt { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the list of classified assets referenced in the article.
|
||||
/// </summary>
|
||||
[JsonPropertyName("matchedAssets")]
|
||||
public List<MatchedAssetDto> MatchedAssets { get; init; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the processing lifecycle state (e.g. "Pending", "Completed", "Analyzed").
|
||||
/// </summary>
|
||||
[JsonPropertyName("status")]
|
||||
public string Status { get; init; } = "Completed";
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the classified sentiment label ("POSITIVE", "NEGATIVE", "NEUTRAL").
|
||||
/// </summary>
|
||||
[JsonPropertyName("sentiment")]
|
||||
public string? Sentiment { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the compound sentiment score (-1.0 to +1.0).
|
||||
/// </summary>
|
||||
[JsonPropertyName("sentimentScore")]
|
||||
public double? SentimentScore { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the FinBERT classification confidence score (0.0 to 1.0).
|
||||
/// </summary>
|
||||
[JsonPropertyName("confidence")]
|
||||
public double? Confidence { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the detailed FinBERT result breakdown.
|
||||
/// </summary>
|
||||
[JsonPropertyName("finbertResult")]
|
||||
public FinBertResultDto? FinbertResult { get; init; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace FinlyticCore.Dtos.News;
|
||||
|
||||
/// <summary>
|
||||
/// Request payload sent by downstream services (e.g., FinlyticSentiment) to update the processing status of a news article.
|
||||
/// </summary>
|
||||
public record UpdateNewsStatusRequest(
|
||||
[property: JsonPropertyName("id")] Guid Id,
|
||||
[property: JsonPropertyName("status")] string Status
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Response payload returned to verify the success of the status update operation.
|
||||
/// </summary>
|
||||
public record UpdateNewsStatusResponse(
|
||||
[property: JsonPropertyName("success")] bool Success,
|
||||
[property: JsonPropertyName("message")] string? Message = null
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user