public static IServiceCollection AddErrorsHealthChecks(
            this IServiceCollection services,
            ErrorsDatabaseConfiguration database,
            ErrorsRabbitMqConfiguration rabbitMq)
        {
            services.AddHealthChecks()
            .AddNpgSql(database.ConnectionString)
            .AddRabbitMQ(rabbitMq.ConnectionString);

            return(services);
        }
        public static IServiceCollection AddErrorsDatabase(
            this IServiceCollection services,
            ErrorsDatabaseConfiguration configuration)
        {
            services.AddDbContextPool <ErrorsContext>(options =>
                                                      options.UseNpgsql(configuration.ConnectionString, builder =>
                                                                        builder.MigrationsHistoryTable(configuration.MigrationsTable))
                                                      .ConfigureWarnings(builder => builder.Throw(RelationalEventId.QueryClientEvaluationWarning)));

            return(services);
        }