refactor(dotnet): separate collection read model service
Validators (Pushes and Pull Requests) / validate-ui-and-storage (push) Successful in 16s
Validators (Pushes and Pull Requests) / validate-core (push) Successful in 2m3s

This commit is contained in:
2026-07-13 00:44:43 +09:00
parent d610ecb57c
commit bccefed35e
6 changed files with 70 additions and 33 deletions
@@ -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)
{