public async Task Run([CosmosDBTrigger( DatabaseName, CollectionName, ConnectionStringSetting = ConnectionString, LeaseCollectionName = LeaseCollectionName, LeaseCollectionPrefix = LeaseCollectionPrefix, CreateLeaseCollectionIfNotExists = true )] IReadOnlyList <Document> documents, ILogger log, [Inject] ReportGenerationServiceResolver reportGenerationServiceResolver) { _reportGenerationService = reportGenerationServiceResolver(ProcessType.Apprenticeship); ApprenticeshipMigrationReport apprenticeshipMigrationReport = null; foreach (var document in documents) { try { apprenticeshipMigrationReport = (ApprenticeshipMigrationReport)((dynamic)document); await _reportGenerationService.UpdateReport(apprenticeshipMigrationReport.ProviderUKPRN); } catch (Exception e) { log.LogError($"Unable to Process document with id: {GetResourceId(apprenticeshipMigrationReport, document)} "); } } }
public ReportController(IMongoReportRepository mongoReportRepository, IReportGenerationService reportGenerationService, IDomoService domoService) { this.mongoReportRepository = mongoReportRepository; this.reportGenerationService = reportGenerationService; this.domoService = domoService; }
public MessageHandler( IReportGenerationService reportGenerationService, ILifetimeScope lifetimeScope, ILogger logger) { _reportGenerationService = reportGenerationService; _lifetimeScope = lifetimeScope; _logger = logger; }
public static async Task <IActionResult> Run( [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequest req, ILogger log, [Inject] IReportGenerationService reportGenerationService) { string fromQuery = req.Query["UKPRN"]; if (!int.TryParse(fromQuery, out int UKPRN)) { return(new BadRequestObjectResult($"Invalid UKPRN value, expected a valid integer")); } try { await reportGenerationService.GenerateReportForProvider(UKPRN); return(new OkResult()); } catch (Exception e) { return(new InternalServerErrorObjectResult(new Exception($"Unable to update provider report for UKPRN : {UKPRN}", e))); } }
public ReportGenerationServiceTests() { _mockRepository = new Mock <IDriverRepository>(); _reportGenerationService = new ReportGenerationService(_mockRepository.Object); }
public CourseMigrationReportTrigger(ReportGenerationServiceResolver reportGenerationServiceResolver) { _reportGenerationService = reportGenerationServiceResolver(ProcessType.Course); }