public override async Task <AggregateOverallResponse> AggregateOverall(AggregateOverallRequest request, ServerCallContext context) { var cardsIds = cardsRepository.GetCardsIds(); var transactionsResponse = await transactionsReadClient.FilterAsync(new FilterTransactionsRequest { Cards = { cardsIds }, TimestampTo = request.TimestampTo, TimestampFrom = request.TimestampFrom }, context.RequestHeaders.SelectCustom()); var aggregations = Aggregations.CreateOverallCsvReport(new OverallReportData { Aggregations = request.Aggregations.ToArray(), Granularity = request.Granularity, Transactions = transactionsResponse.Transactions.ToArray() }); return(new AggregateOverallResponse { Portions = { aggregations } }); }
public override Task <AggregateOverallResponse> AggregateOverall(AggregateOverallRequest request, Grpc.Core.ServerCallContext context) { var filters = new Filters { TimestampFrom = request.TimestampFrom.ToDateTime(), TimestampTo = request.TimestampTo.ToDateTime() }; var transactions = transactionsRepository.GetMany(filters, 0).Select(t => mapper.Map <Transaction>(t)).ToArray(); var aggregations = Aggregations.CreateOverallCsvReport(new OverallReportData { Aggregations = request.Aggregations.ToArray(), Granularity = request.Granularity, Transactions = transactions }); return(Task.FromResult(new AggregateOverallResponse { Portions = { aggregations } })); }