using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using RecNet.Application.Common.Interfaces; using RecNet.Domain.Repositories; using RecNet.Infrastructure.Persistence; using RecNet.Infrastructure.Persistence.Repositories; using RecNet.Infrastructure.Services.Configuration; using RecNet.Infrastructure.Services.Tokens; namespace RecNet.Infrastructure; public static class DependencyInjection { public static TBuilder AddInfrastructure(this TBuilder builder) where TBuilder : IHostApplicationBuilder { builder.AddNpgsqlDbContext("recnet"); builder.Services .AddOptions() .Bind(builder.Configuration.GetSection("Jwt")) .Validate(options => !string.IsNullOrWhiteSpace(options.Secret), "JWT secret is required.") .ValidateOnStart(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); return builder; } }