refactor(assets): update asset entity mappings, database migrations, and MQTT RPC handlers

This commit is contained in:
2026-08-24 21:37:21 +02:00
parent 7060f0f7b1
commit 6974b2075b
26 changed files with 645 additions and 2237 deletions
-2
View File
@@ -7,8 +7,6 @@ public abstract class AssetEntity
public string Type { get; set; } = string.Empty;
public string InstrumentCategory { get; set; } = string.Empty;
public bool HasCfd { get; set; }
public string? ImageId { get; set; }
public DateTime LastUpdatedAt { get; set; } = DateTime.UtcNow;
public List<TagEntity> Tags { get; set; } = new();
+10 -3
View File
@@ -11,11 +11,17 @@ public enum OptionType
Short
}
public class DerivativeEntity : AssetEntity
public class DerivativeEntity
{
[Key]
[StringLength(12, MinimumLength = 12)]
public string Isin { get; set; } = string.Empty;
// --- Verknüpfung zum Basiswert (Underlying) ---
[StringLength(12, MinimumLength = 12)]
public string? UnderlyingIsin { get; set; }
public string UnderlyingIsin { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
// --- Derivat-Spezifikationen ---
public OptionType OptionType { get; set; } // Long / Short
@@ -54,7 +60,8 @@ public class DerivativeEntity : AssetEntity
[MaxLength(150)]
public string IssuerDisplayName { get; set; } = string.Empty;
public string? IssuerImageId { get; set; }
public DateTime LastUpdatedAt { get; set; } = DateTime.UtcNow;
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
// PostgreSQL Mapped Array für TR-Kategorien
public List<string> DerivativeProductCategories { get; set; } = new();
-68
View File
@@ -1,68 +0,0 @@
using System;
using System.ComponentModel.DataAnnotations;
using FinlyticAssets.Models;
using FinlyticCore.Models.Assets;
namespace FinlyticAssets.Entities;
/// <summary>
/// Represents the global synchronization and timing configurations for the Trade Republic asset scanner.
/// </summary>
public class Settings
{
/// <summary>
/// Gets or sets the unique identifier for the settings record.
/// </summary>
[Key]
public Guid Id { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the very first full scan of all assets has been completed.
/// Used to switch from fast initial discovery delays to stealthy incremental update delays.
/// </summary>
public bool FinishedInitialScan { get; set; }
/// <summary>
/// Gets or sets the maximum number of assets requested per single API pagination call.
/// Values around 100 look like standard dynamic-scrolling payloads from a real client device.
/// </summary>
public int TradeRepublicMaxRequestPageSize { get; set; } = 100;
/// <summary>
/// Gets or sets the idle delay in seconds between switching from one full asset category to another (e.g., from Stocks to Crypto)
/// during standard maintenance mode. (Default 12000s = ~3.3 hours).
/// </summary>
public int AssetUpdateTypeDelay { get; set; } = 12000;
/// <summary>
/// Gets or sets the idle delay in seconds between switching asset categories during the initial setup scan.
/// Set to 0 to move immediately to the next type after finishing the current one. (Default 0s).
/// </summary>
public int InitAssetUpdateTypeDelay { get; set; } = 0;
/// <summary>
/// Gets or sets the baseline delay in seconds between sequential page requests of the same asset type during the initial setup scan.
/// (Default 120s = 2 minutes).
/// </summary>
public int InitBatchAssetUpdateDelay { get; set; } = 120;
/// <summary>
/// Gets or sets the standard baseline delay in seconds between sequential page requests of the same asset type during recurring incremental updates.
/// Spreads pagination widely over time to blend into regular human traffic profiles. (Default 600s = 10 minutes).
/// </summary>
public int BatchAssetUpdateDelay { get; set; } = 600;
/// <summary>
/// Gets or sets the asset type that is currently being processed by the full scan.
/// Acts as a live pointer for recovery after a service interruption.
/// </summary>
public AssetType CurrentScanningType { get; set; } = AssetType.Stock;
/// <summary>
/// Gets or sets the page number of the <see cref="CurrentScanningType"/> that is currently being fetched or was just processed.
/// Trade Republic uses 1-based pagination. A value of 0 means the scan is currently idle or between types.
/// </summary>
public int CurrentScanningPage { get; set; } = 0;
}