public async Task <string> Overall(OverallReportRequest data)
        {
            var payload = new AggregateOverallReportDataEvent
            {
                Granularity   = data.Granularity,
                TimestampFrom = data.TimestampFrom,
                TimestampTo   = data.TimestampTo,
                Aggregations  = data.Aggregations,
                Subject       = data.Subject,
            };
            var flowId   = HttpContext.Items["flowId"].ToString();
            var response = await eventsAwaiter.AwaitResponse <AggregatedOverallReportEvent>(flowId, () => publishingRouter.Publish(Queues.Transactions, payload, flowId, Queues.APIGateway));

            return(ReportCsvSerializer.SerializerOverallReport(data.Subject, data.TimestampFrom, data.TimestampTo, data.Granularity, response.Portions));
        }
示例#2
0
        public async Task <string> Overall(OverallReportRequest request)
        {
            var flowId      = HttpContext.Items["flowId"].ToString();
            var cqrsRequest = new AggregateOverallRequest
            {
                FlowId        = flowId,
                Granularity   = mapper.Map <Granularity>(request.Granularity),
                TimestampFrom = request.TimestampFrom.ToNullableTimestamp(),
                TimestampTo   = request.TimestampTo.ToNullableTimestamp(),
                Aggregations  = { request.Aggregations.Select(a => mapper.Map <Aggregation>(a)) }
            };
            var data = await reportDataFetcher.GetOverallReportPortions(cqrsRequest, HttpContext.CreateHeadersWithFlowId(), request.Subject);

            var csv = ReportCsvSerializer.SerializerOverallReport(request.Subject,
                                                                  request.TimestampFrom,
                                                                  request.TimestampTo,
                                                                  request.Granularity,
                                                                  data);

            return(csv);
        }