refactor(dotnet): separate collection read model service
This commit is contained in:
@@ -2,6 +2,7 @@ using System.IO;
|
||||
using System.Reflection;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using QuantEngine.Application.Interfaces;
|
||||
using QuantEngine.Core.Interfaces;
|
||||
using QuantEngine.Web.Services;
|
||||
|
||||
@@ -11,7 +12,7 @@ namespace QuantEngine.Web.Pages.Admin.Dashboard;
|
||||
public class IndexModel : PageModel
|
||||
{
|
||||
private readonly IWorkspaceRepository _workspaceRepository;
|
||||
private readonly ICollectionRepository _collectionRepository;
|
||||
private readonly ICollectionReadModelService _collectionReadModelService;
|
||||
private readonly IWebHostEnvironment _environment;
|
||||
private readonly ILogger<IndexModel> _logger;
|
||||
|
||||
@@ -95,12 +96,12 @@ public class IndexModel : PageModel
|
||||
|
||||
public IndexModel(
|
||||
IWorkspaceRepository workspaceRepository,
|
||||
ICollectionRepository collectionRepository,
|
||||
ICollectionReadModelService collectionReadModelService,
|
||||
IWebHostEnvironment environment,
|
||||
ILogger<IndexModel> logger)
|
||||
{
|
||||
_workspaceRepository = workspaceRepository;
|
||||
_collectionRepository = collectionRepository;
|
||||
_collectionReadModelService = collectionReadModelService;
|
||||
_environment = environment;
|
||||
_logger = logger;
|
||||
}
|
||||
@@ -112,7 +113,7 @@ public class IndexModel : PageModel
|
||||
var accounts = await _workspaceRepository.GetAccountsAsync();
|
||||
ActiveUsersCount = accounts.Count(a => string.Equals(a.IsActive, "true", StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
var dashboard = await _collectionRepository.GetDashboardStateAsync();
|
||||
var dashboard = await _collectionReadModelService.GetDashboardStateAsync();
|
||||
RecentRunsCount = string.IsNullOrEmpty(dashboard?.LastRunId) ? 0 : 1;
|
||||
|
||||
// These two queries only complete if the DB round-trip actually
|
||||
|
||||
Reference in New Issue
Block a user