예제 #1
0
        public async Task <string> UserActivity(UserActivityReportRequest request)
        {
            var flowId      = HttpContext.Items["flowId"].ToString();
            var granularity = mapper.Map <Granularity>(request.Granularity);
            var portions    = await reportDataFetcher.GetUserActivityPortions(HttpContext.CreateHeadersWithFlowId(), request.UserId, request.TimestampFrom.ToNullableTimestamp(), request.TimestampTo.ToNullableTimestamp(), granularity);

            var csv = ReportCsvSerializer.SerializerUserActivityReport(request.UserId, request.TimestampFrom, request.TimestampTo, request.Granularity, portions);

            return(csv);
        }
        public async Task <string> UserActivity(UserActivityReportRequest data)
        {
            var payload = new AggregateUserActivityReportDataEvent
            {
                Granularity   = data.Granularity,
                TimestampFrom = data.TimestampFrom,
                TimestampTo   = data.TimestampTo,
                UserId        = data.UserId,
            };
            var flowId   = HttpContext.Items["flowId"].ToString();
            var response = await eventsAwaiter.AwaitResponse <AggregatedUserActivityReportEvent>(flowId, () => publishingRouter.Publish(Queues.Transactions, payload, flowId, Queues.APIGateway));

            return(ReportCsvSerializer.SerializerUserActivityReport(data.UserId, data.TimestampFrom, data.TimestampTo, data.Granularity, response));
        }
        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));
        }
예제 #4
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);
        }