private async Task <(string block, string url)> SaveReport(string block) { try { await _log.WriteInfoAsync(nameof(SaveReport), nameof(SaveReport), block, "Started"); await _metadataRepository.SetProcessing(block); var meta = await _metadataRepository.Get(block); if (meta?.FileUrl != null) { await _metadataRepository.SetDone(block, meta.FileUrl); return(block, meta.FileUrl); } var reportData = await _reportService.GetTransactionsReport(block); var saveResult = await _reportStorage.SaveXlsxReport(block, reportData); await _metadataRepository.SetDone(block, saveResult.Url); await _log.WriteInfoAsync(nameof(BlockTransactionsQueueFunctions), nameof(SaveReport), block, "Done"); return(block, saveResult.Url); } catch (Exception e) { await _log.WriteErrorAsync(nameof(BlockTransactionsQueueFunctions), nameof(CreateReport), block, e); await _metadataRepository.SetError(block, e.ToString()); throw; } }
public async Task <BlockReportMetadataViewModel> GetReport(string block) { var result = await _reportMetadataRepository.Get(block); return(result != null?BlockReportMetadataViewModel.Create(result) : null); }