refactor(dotnet): separate collection read model service
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
using QuantEngine.Core.Interfaces;
|
||||
|
||||
namespace QuantEngine.Application.Interfaces;
|
||||
|
||||
public interface ICollectionReadModelService
|
||||
{
|
||||
Task<CollectionDashboardStateRecord> GetDashboardStateAsync();
|
||||
Task<List<CollectionRunRecord>> GetRecentRunsAsync(int limit = 20);
|
||||
Task<List<CollectionSnapshotRecord>> GetRunSnapshotsAsync(string runId);
|
||||
Task<List<CollectionErrorRecord>> GetRunErrorsAsync(string runId, int limit = 50);
|
||||
Task<List<CollectionSnapshotRecord>> GetLatestSnapshotsForTickerAsync(string ticker, int limit = 10);
|
||||
Task<List<PriceHistorySummaryRecord>> GetPriceHistorySummaryAsync();
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using QuantEngine.Application.Interfaces;
|
||||
using QuantEngine.Core.Interfaces;
|
||||
|
||||
namespace QuantEngine.Application.Services;
|
||||
|
||||
public sealed class CollectionReadModelService : ICollectionReadModelService
|
||||
{
|
||||
private readonly ICollectionRepository _repository;
|
||||
|
||||
public CollectionReadModelService(ICollectionRepository repository)
|
||||
{
|
||||
_repository = repository;
|
||||
}
|
||||
|
||||
public Task<CollectionDashboardStateRecord> GetDashboardStateAsync() => _repository.GetDashboardStateAsync();
|
||||
public Task<List<CollectionRunRecord>> GetRecentRunsAsync(int limit = 20) => _repository.GetRecentRunsAsync(limit);
|
||||
public Task<List<CollectionSnapshotRecord>> GetRunSnapshotsAsync(string runId) => _repository.GetRunSnapshotsAsync(runId);
|
||||
public Task<List<CollectionErrorRecord>> GetRunErrorsAsync(string runId, int limit = 50) => _repository.GetRunErrorsAsync(runId, limit);
|
||||
public Task<List<CollectionSnapshotRecord>> GetLatestSnapshotsForTickerAsync(string ticker, int limit = 10) => _repository.GetLatestSnapshotsForTickerAsync(ticker, limit);
|
||||
public Task<List<PriceHistorySummaryRecord>> GetPriceHistorySummaryAsync() => _repository.GetPriceHistorySummaryAsync();
|
||||
}
|
||||
Reference in New Issue
Block a user