feat(backend): add admin evaluation history, engine, simulation, bot API controllers and global exception middleware
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
@@ -8,6 +9,7 @@ namespace FinlyticBackend.Hubs;
|
||||
/// <summary>
|
||||
/// SignalR Hub that streams live log messages from microservices to connected web UI clients.
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
public class LogStreamHub : Hub
|
||||
{
|
||||
private readonly ILogger<LogStreamHub> _logger;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using System.Threading.Tasks;
|
||||
using FinlyticCore.Dtos.News;
|
||||
@@ -7,6 +8,7 @@ namespace FinlyticBackend.Hubs;
|
||||
/// <summary>
|
||||
/// SignalR Hub for real-time news delivery to connected clients.
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
public class NewsHub : Hub
|
||||
{
|
||||
// Clients can call this to join specific symbol groups if needed later
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
@@ -8,6 +9,7 @@ namespace FinlyticBackend.Hubs;
|
||||
/// <summary>
|
||||
/// SignalR Hub broadcasting real-time system diagnostics & microservice health updates to connected clients.
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
public class SystemHealthHub : Hub
|
||||
{
|
||||
private readonly ILogger<SystemHealthHub> _logger;
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
|
||||
namespace FinlyticBackend.Hubs;
|
||||
|
||||
/// <summary>
|
||||
/// SignalR Hub broadcasting real-time trade signals, position updates, and closed trade events.
|
||||
/// </summary>
|
||||
public class TradeHub : Hub
|
||||
{
|
||||
public override async Task OnConnectedAsync()
|
||||
{
|
||||
await base.OnConnectedAsync();
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using FinlyticCore.Models.Auth;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace FinlyticBackend.Hubs;
|
||||
|
||||
/// <summary>
|
||||
/// Real-time SignalR WebSocket & Server-Sent Events (SSE) Hub streaming live trade proposals & updates to Web and Mobile clients.
|
||||
/// </summary>
|
||||
public class TradeRealtimeHub : Hub<ITradeClient>
|
||||
{
|
||||
private readonly ILogger<TradeRealtimeHub> _logger;
|
||||
|
||||
public TradeRealtimeHub(ILogger<TradeRealtimeHub> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public override async Task OnConnectedAsync()
|
||||
{
|
||||
_logger.LogInformation("Real-time SignalR Client connected: ConnectionId={ConnectionId}, User={User}",
|
||||
Context.ConnectionId, Context.User?.Identity?.Name ?? "Anonymous");
|
||||
await base.OnConnectedAsync();
|
||||
}
|
||||
|
||||
public override async Task OnDisconnectedAsync(Exception? exception)
|
||||
{
|
||||
_logger.LogInformation("Real-time SignalR Client disconnected: ConnectionId={ConnectionId}", Context.ConnectionId);
|
||||
await base.OnDisconnectedAsync(exception);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using System.Threading.Tasks;
|
||||
using FinlyticCore.Dtos.Bot;
|
||||
using FinlyticCore.Dtos.Trading;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
|
||||
namespace FinlyticBackend.Hubs;
|
||||
|
||||
public interface ITradeStreamClient
|
||||
{
|
||||
Task ReceiveTradeProposal(TradeProposalDto proposal);
|
||||
Task ReceiveTradeUpdate(ActiveTradeDto trade);
|
||||
Task ReceiveBotPositionUpdate(BotTradeOrderDto botOrder);
|
||||
Task ReceivePortfolioSummary(AccountSummaryDto summary);
|
||||
}
|
||||
|
||||
[Authorize]
|
||||
public class TradeStreamHub : Hub<ITradeStreamClient>
|
||||
{
|
||||
public async Task JoinAssetGroup(string isin)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(isin))
|
||||
{
|
||||
await Groups.AddToGroupAsync(Context.ConnectionId, isin.Trim().ToUpperInvariant());
|
||||
}
|
||||
}
|
||||
|
||||
public async Task LeaveAssetGroup(string isin)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(isin))
|
||||
{
|
||||
await Groups.RemoveFromGroupAsync(Context.ConnectionId, isin.Trim().ToUpperInvariant());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user