Exemplo n.º 1
0
        public async Task <Responses.WorkerPerformanceStatsContainer[]> GetMinerPerformanceAsync(
            string poolId, string address, long start, long end)
        {
            var pool = GetPool(poolId);

            var(startDate, endDate) = parseStartEndRequestParams(start, end);

            if (string.IsNullOrEmpty(address))
            {
                throw new ApiException($"Invalid or missing miner address", HttpStatusCode.NotFound);
            }

            Persistence.Model.Projections.WorkerPerformanceStatsContainer[] stats = null;
            stats = await cf.Run(con => statsRepo.GetMinerPerformanceAsync(
                                     con, pool.Id, address, startDate, endDate));

            // map
            var result = mapper.Map <Responses.WorkerPerformanceStatsContainer[]>(stats);

            return(result);
        }