refactor(dotnet): separate collection read model service
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using QuantEngine.Application.Interfaces;
|
||||
using QuantEngine.Core.Interfaces;
|
||||
using QuantEngine.Web.Services;
|
||||
|
||||
@@ -8,16 +9,16 @@ namespace QuantEngine.Web.Pages.Admin.Collection;
|
||||
[Authorize(AuthenticationSchemes = AdminAuthDefaults.Scheme)]
|
||||
public class IndexModel : PageModel
|
||||
{
|
||||
private readonly ICollectionRepository _collectionRepository;
|
||||
private readonly ICollectionReadModelService _collectionReadModelService;
|
||||
private readonly ILogger<IndexModel> _logger;
|
||||
|
||||
public List<CollectionRunRecord>? Runs { get; set; }
|
||||
public List<PriceHistorySummaryRecord>? HistorySummary { get; set; }
|
||||
public string? Message { get; set; }
|
||||
|
||||
public IndexModel(ICollectionRepository collectionRepository, ILogger<IndexModel> logger)
|
||||
public IndexModel(ICollectionReadModelService collectionReadModelService, ILogger<IndexModel> logger)
|
||||
{
|
||||
_collectionRepository = collectionRepository;
|
||||
_collectionReadModelService = collectionReadModelService;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
@@ -25,8 +26,8 @@ public class IndexModel : PageModel
|
||||
{
|
||||
try
|
||||
{
|
||||
Runs = await _collectionRepository.GetRecentRunsAsync(limit: 20);
|
||||
HistorySummary = await _collectionRepository.GetPriceHistorySummaryAsync();
|
||||
Runs = await _collectionReadModelService.GetRecentRunsAsync(limit: 20);
|
||||
HistorySummary = await _collectionReadModelService.GetPriceHistorySummaryAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user