using Meezi.Core.Interfaces; using Meezi.Infrastructure.Data; using Meezi.Infrastructure.ExternalServices; using Meezi.Infrastructure.Services; using Meezi.Infrastructure.Services.Platform; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; namespace Meezi.Infrastructure; public static class DependencyInjection { public static IServiceCollection AddInfrastructure(this IServiceCollection services, IConfiguration configuration) { var connectionString = configuration.GetConnectionString("DefaultConnection") ?? throw new InvalidOperationException("Connection string 'DefaultConnection' not found."); services.AddDbContext(options => options.UseNpgsql(connectionString)); services.AddScoped(); services.AddScoped(sp => sp.GetRequiredService()); services.AddScoped(); services.AddScoped(sp => sp.GetRequiredService()); services.AddScoped(); services.AddMemoryCache(); services.AddScoped(); services.AddScoped(); services.AddHttpClient(); services.AddHttpClient(); services.AddHttpClient(); services.AddHttpClient(); services.AddHttpClient(); services.AddHttpClient(); services.AddHttpClient(); services.AddScoped(); return services; } }