Fix: Fecha de Vencimiento y Aviso Aplica a Admins (Tipo 3).

This commit is contained in:
2026-03-11 10:17:56 -03:00
parent c60d7be293
commit 88b558afd4

View File

@@ -97,8 +97,8 @@ public class AdExpirationService : BackgroundService
a.StatusID == (int)AdStatusEnum.Active &&
// Regla 2: Publicado hace más de 30 días
a.PublishedAt.HasValue && a.PublishedAt.Value < cutoffDate &&
// --- CAMBIO AQUÍ: Excluimos avisos de administradores ---
a.User != null && a.User.UserType != 3
// Aplica a todos los usuarios, incluyendo administradores
a.User != null
)
.ToListAsync();
@@ -118,7 +118,7 @@ public class AdExpirationService : BackgroundService
Entity = "Ad",
EntityID = ad.AdID,
UserID = 0,
Details = $"Aviso ID {ad.AdID} vencido. Email enviado a usuario no-admin."
Details = $"Aviso ID {ad.AdID} vencido automáticamente por el sistema."
});
}
if (expiredAds.Any()) await context.SaveChangesAsync();
@@ -141,8 +141,8 @@ public class AdExpirationService : BackgroundService
a.StatusID == (int)AdStatusEnum.Active &&
a.PublishedAt.HasValue && a.PublishedAt.Value <= warningThreshold &&
!a.ExpirationWarningSent &&
// --- CAMBIO AQUÍ: Excluimos avisos de administradores ---
a.User != null && a.User.UserType != 3
// Aplica a todos los usuarios, incluyendo administradores
a.User != null
)
.ToListAsync();