Fix: Fecha de Vencimiento y Aviso Aplica a Admins (Tipo 3).
This commit is contained in:
@@ -97,8 +97,8 @@ public class AdExpirationService : BackgroundService
|
|||||||
a.StatusID == (int)AdStatusEnum.Active &&
|
a.StatusID == (int)AdStatusEnum.Active &&
|
||||||
// Regla 2: Publicado hace más de 30 días
|
// Regla 2: Publicado hace más de 30 días
|
||||||
a.PublishedAt.HasValue && a.PublishedAt.Value < cutoffDate &&
|
a.PublishedAt.HasValue && a.PublishedAt.Value < cutoffDate &&
|
||||||
// --- CAMBIO AQUÍ: Excluimos avisos de administradores ---
|
// Aplica a todos los usuarios, incluyendo administradores
|
||||||
a.User != null && a.User.UserType != 3
|
a.User != null
|
||||||
)
|
)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
@@ -118,7 +118,7 @@ public class AdExpirationService : BackgroundService
|
|||||||
Entity = "Ad",
|
Entity = "Ad",
|
||||||
EntityID = ad.AdID,
|
EntityID = ad.AdID,
|
||||||
UserID = 0,
|
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();
|
if (expiredAds.Any()) await context.SaveChangesAsync();
|
||||||
@@ -141,8 +141,8 @@ public class AdExpirationService : BackgroundService
|
|||||||
a.StatusID == (int)AdStatusEnum.Active &&
|
a.StatusID == (int)AdStatusEnum.Active &&
|
||||||
a.PublishedAt.HasValue && a.PublishedAt.Value <= warningThreshold &&
|
a.PublishedAt.HasValue && a.PublishedAt.Value <= warningThreshold &&
|
||||||
!a.ExpirationWarningSent &&
|
!a.ExpirationWarningSent &&
|
||||||
// --- CAMBIO AQUÍ: Excluimos avisos de administradores ---
|
// Aplica a todos los usuarios, incluyendo administradores
|
||||||
a.User != null && a.User.UserType != 3
|
a.User != null
|
||||||
)
|
)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user