38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
using System.Text.Json.Serialization;
|
|
|
|
namespace Backend.DatabaseHandler
|
|
{
|
|
public sealed class NewsSentimentRecord
|
|
{
|
|
public string Source { get; init; } = string.Empty;
|
|
public string Keyword { get; init; } = string.Empty;
|
|
public DateTimeOffset PublishedAt { get; init; }
|
|
public string Title { get; init; } = string.Empty;
|
|
public double Score { get; init; }
|
|
public string SentimentLabel { get; init; } = string.Empty;
|
|
|
|
[JsonIgnore]
|
|
public string TitleHash { get; init; } = string.Empty;
|
|
public string Publisher { get; init; } = string.Empty;
|
|
public string Url { get; init; } = string.Empty;
|
|
}
|
|
|
|
public sealed class NewsFeedItem
|
|
{
|
|
public string Title { get; init; } = string.Empty;
|
|
public string Publisher { get; init; } = string.Empty;
|
|
public double Score { get; init; }
|
|
public string PublishedAt { get; init; } = string.Empty;
|
|
public string Url { get; init; } = string.Empty;
|
|
|
|
public static NewsFeedItem From(NewsSentimentRecord r) => new()
|
|
{
|
|
Title = r.Title,
|
|
Publisher = r.Publisher,
|
|
Score = r.Score,
|
|
PublishedAt = r.PublishedAt.UtcDateTime.ToString("yyyy-MM-ddTHH:mm:ssZ"),
|
|
Url = r.Url
|
|
};
|
|
}
|
|
}
|