// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IServiceProvider services, IBackgroundJobClient backgroundJobs, IRecurringJobManager recurringJobs) { app.UseCors(); app.UseHangfireDashboard(); var mismeBackJobs = services.GetRequiredService <IMismeBackgroundService>(); recurringJobs.AddOrUpdate <IMismeBackgroundService>("ExpiredTokens", (e) => e.CleanExpiredTokensAsync(), "0 3 * * *"); recurringJobs.AddOrUpdate <IMismeBackgroundService>("DisabledAccount", (e) => e.RemoveDisabledAccountsAsync(), "0 3 * * *"); //recurringJobs.AddOrUpdate<IMismeBackgroundService>("Notifications", (e) => e.SendFireBaseNotificationsRemindersAsync(), "0 18 * * *"); recurringJobs.AddOrUpdate <IMismeBackgroundService>("HandleUserStreaksWest", (e) => e.HandleUserStreaksAsync(1), "0 10 * * *", TimeZoneInfo.Utc); recurringJobs.AddOrUpdate <IMismeBackgroundService>("HandleUserStreaksEast", (e) => e.HandleUserStreaksAsync(-1), "0 23 * * *", TimeZoneInfo.Utc); recurringJobs.AddOrUpdate <IMismeBackgroundService>("HandleSubscriptions", (e) => e.HandleSubscriptionsAsync(), "0 12 * * *", TimeZoneInfo.Utc); //recurringJobs.AddOrUpdate<IMismeBackgroundService>("SendPlanifyEventNotificationAsync", (e) => e.SendPlanifyEventNotificationAsync(), "0 12 ? * 3,6", TimeZoneInfo.Utc); recurringJobs.AddOrUpdate <IMismeBackgroundService>("SendReportsAsync", (e) => e.SendReportsAsync(), "0 7 * * 0", TimeZoneInfo.Utc); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseHsts(); } app.UseSwagger(); app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "Misme API V1"); }); app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); app.UseMiddleware(typeof(ErrorWrappingMiddleware)); app.UseResponseCompression(); app.UseEndpoints(endpoints => { endpoints.MapHub <UserHub>("/userHub", map => { }); endpoints.MapHealthChecks("/health", new HealthCheckOptions() { ResultStatusCodes = { [HealthStatus.Healthy] = StatusCodes.Status200OK, [HealthStatus.Degraded] = StatusCodes.Status200OK, [HealthStatus.Unhealthy] = StatusCodes.Status503ServiceUnavailable } }); endpoints.MapControllers(); }); DatabaseSeed.SeedDatabaseAsync(services).Wait(); }