- LoginRequestDto, LoginResponseDto 추가 - IAuthService, AuthService 구현 (BCrypt 비밀번호 검증) - AdminRepository 구현 (GetByEmailAsync) - AuthController 추가 (POST /v1/in/auth/login) - DI 등록 (IAuthService, IAdminRepository) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
37 lines
1.3 KiB
C#
37 lines
1.3 KiB
C#
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using SPMS.Application.Interfaces;
|
|
using SPMS.Domain.Interfaces;
|
|
using SPMS.Infrastructure.Auth;
|
|
using SPMS.Infrastructure.Persistence;
|
|
using SPMS.Infrastructure.Persistence.Repositories;
|
|
using SPMS.Infrastructure.Security;
|
|
|
|
namespace SPMS.Infrastructure;
|
|
|
|
public static class DependencyInjection
|
|
{
|
|
public static IServiceCollection AddInfrastructure(
|
|
this IServiceCollection services,
|
|
IConfiguration configuration)
|
|
{
|
|
// DbContext
|
|
var connectionString = configuration.GetConnectionString("DefaultConnection");
|
|
services.AddDbContext<AppDbContext>(options =>
|
|
options.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString)));
|
|
|
|
// UnitOfWork & Repositories
|
|
services.AddScoped<IUnitOfWork, UnitOfWork>();
|
|
services.AddScoped(typeof(IRepository<>), typeof(Repository<>));
|
|
services.AddScoped<IServiceRepository, ServiceRepository>();
|
|
services.AddScoped<IAdminRepository, AdminRepository>();
|
|
|
|
// External Services
|
|
services.AddScoped<IJwtService, JwtService>();
|
|
services.AddSingleton<IE2EEService, E2EEService>();
|
|
|
|
return services;
|
|
}
|
|
}
|