using SIGCM2.Application.Abstractions; using SIGCM2.Application.Abstractions.Persistence; namespace SIGCM2.Application.Auth.Logout; public sealed class LogoutCommandHandler : ICommandHandler { private readonly IRefreshTokenRepository _refreshRepo; public LogoutCommandHandler(IRefreshTokenRepository refreshRepo) { _refreshRepo = refreshRepo; } public async Task Handle(LogoutCommand command) { // Revoke all active tokens for the user across all families. // Idempotent: 0 rows affected is not an error. await _refreshRepo.RevokeAllActiveForUserAsync(command.UsuarioId, DateTime.UtcNow); return new LogoutResponseDto(true, "Sesión cerrada correctamente"); } }