2026-04-13 21:36:01 -03:00
|
|
|
using FluentValidation;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using SIGCM2.Application.Abstractions;
|
|
|
|
|
using SIGCM2.Application.Auth.Login;
|
2026-04-14 13:28:36 -03:00
|
|
|
using SIGCM2.Application.Auth.Logout;
|
|
|
|
|
using SIGCM2.Application.Auth.Refresh;
|
2026-04-13 21:36:01 -03:00
|
|
|
|
|
|
|
|
namespace SIGCM2.Application;
|
|
|
|
|
|
|
|
|
|
public static class DependencyInjection
|
|
|
|
|
{
|
|
|
|
|
public static IServiceCollection AddApplication(this IServiceCollection services)
|
|
|
|
|
{
|
2026-04-14 13:28:36 -03:00
|
|
|
// Command handlers
|
2026-04-13 21:36:01 -03:00
|
|
|
services.AddScoped<ICommandHandler<LoginCommand, LoginResponseDto>, LoginCommandHandler>();
|
2026-04-14 13:28:36 -03:00
|
|
|
services.AddScoped<ICommandHandler<RefreshCommand, RefreshResponseDto>, RefreshCommandHandler>();
|
|
|
|
|
services.AddScoped<ICommandHandler<LogoutCommand, LogoutResponseDto>, LogoutCommandHandler>();
|
2026-04-13 21:36:01 -03:00
|
|
|
|
2026-04-14 13:28:36 -03:00
|
|
|
// FluentValidation validators (scans entire Application assembly)
|
2026-04-13 21:36:01 -03:00
|
|
|
services.AddValidatorsFromAssemblyContaining<LoginCommandValidator>();
|
|
|
|
|
|
|
|
|
|
return services;
|
|
|
|
|
}
|
|
|
|
|
}
|