Beispiel #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 request = new AggregateUserActivityRequest
            {
                Granularity   = mapper.Map <Granularity>(data.Granularity),
                TimestampFrom = data.TimestampFrom.ToNullableTimestamp(),
                TimestampTo   = data.TimestampTo.ToNullableTimestamp(),
                UserId        = data.UserId,
            };
            var response = await reportsBranchClient.AggregateUserActivityAsync(request, HttpContext.CreateHeadersWithFlowId());

            return(response.Report);
        }
        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));
        }