using GymLogAI.Application.Interfaces; using GymLogAI.Core.Abstractions; using GymLogAI.Persistence.Infrastructure; using GymLogAI.Persistence.Repositories; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; namespace GymLogAI.Persistence; public static class DependencyInjection { public static IServiceCollection AddPersistence(this IServiceCollection services, IConfiguration configuration) { var connectionString = configuration.GetConnectionString("Postgres") ?? "Host=localhost;Port=5432;Database=gymlogai;Username=postgres;Password=postgres"; services.AddDbContext(options => options.UseNpgsql(connectionString)); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddSingleton(); services.AddSingleton(); return services; } }