private static async Task UpdateMasterGames() { _awsRegion = ConfigurationManager.AppSettings["awsRegion"] !; _betaBucket = ConfigurationManager.AppSettings["betaBucket"] !; _productionReadOnlyConnectionString = ConfigurationManager.AppSettings["productionConnectionString"] !; _betaConnectionString = ConfigurationManager.AppSettings["betaConnectionString"] !; DapperNodaTimeSetup.Register(); MySQLFantasyCriticUserStore productionUserStore = new MySQLFantasyCriticUserStore(_productionReadOnlyConnectionString, _clock); MySQLFantasyCriticUserStore betaUserStore = new MySQLFantasyCriticUserStore(_betaConnectionString, _clock); MySQLMasterGameRepo productionMasterGameRepo = new MySQLMasterGameRepo(_productionReadOnlyConnectionString, productionUserStore); MySQLMasterGameRepo betaMasterGameRepo = new MySQLMasterGameRepo(_betaConnectionString, betaUserStore); MySQLBetaCleaner cleaner = new MySQLBetaCleaner(_betaConnectionString); AdminService betaAdminService = GetAdminService(); _logger.Info("Getting master games from production"); var productionMasterGameTags = await productionMasterGameRepo.GetMasterGameTags(); var productionMasterGames = await productionMasterGameRepo.GetMasterGames(); var betaMasterGameTags = await betaMasterGameRepo.GetMasterGameTags(); var betaMasterGames = await betaMasterGameRepo.GetMasterGames(); IReadOnlyList <MasterGameHasTagEntity> productionGamesHaveTagEntities = await GetProductionGamesHaveTagEntities(); await cleaner.UpdateMasterGames(productionMasterGameTags, productionMasterGames, betaMasterGameTags, betaMasterGames, productionGamesHaveTagEntities); await betaAdminService.RefreshCaches(); }
private static AdminService GetAdminService() { FantasyCriticUserManager userManager = null !; IFantasyCriticUserStore betaUserStore = new MySQLFantasyCriticUserStore(_betaConnectionString, _clock); IMasterGameRepo masterGameRepo = new MySQLMasterGameRepo(_betaConnectionString, betaUserStore); IFantasyCriticRepo fantasyCriticRepo = new MySQLFantasyCriticRepo(_betaConnectionString, betaUserStore, masterGameRepo); InterLeagueService interLeagueService = new InterLeagueService(fantasyCriticRepo, masterGameRepo); LeagueMemberService leagueMemberService = new LeagueMemberService(null !, fantasyCriticRepo, _clock); GameAcquisitionService gameAcquisitionService = new GameAcquisitionService(fantasyCriticRepo, masterGameRepo, leagueMemberService, _clock); ActionProcessingService actionProcessingService = new ActionProcessingService(gameAcquisitionService); FantasyCriticService fantasyCriticService = new FantasyCriticService(leagueMemberService, interLeagueService, fantasyCriticRepo, _clock); IOpenCriticService openCriticService = null !; IGGService ggService = null !; PatreonService patreonService = null !; IRDSManager rdsManager = null !; RoyaleService royaleService = null !; IHypeFactorService hypeFactorService = new LambdaHypeFactorService(_awsRegion, _betaBucket); AdminServiceConfiguration configuration = new AdminServiceConfiguration(true); var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"); var realHypeConstantsEnvironments = new List <string>() { "STAGING", "PRODUCTION" }; if (environment is not null && realHypeConstantsEnvironments.Contains(environment.ToUpper())) { configuration = new AdminServiceConfiguration(false); } return(new AdminService(fantasyCriticService, userManager, fantasyCriticRepo, masterGameRepo, interLeagueService, openCriticService, ggService, patreonService, _clock, rdsManager, royaleService, hypeFactorService, configuration, actionProcessingService)); }