260217:1607 20260217 fix permission
All checks were successful
Build and Deploy / deploy (push) Successful in 3m11s

This commit is contained in:
admin
2026-02-17 16:07:10 +07:00
parent 55e6a563aa
commit 01ce68acda
5 changed files with 213 additions and 21 deletions

View File

@@ -10,7 +10,7 @@ export class NotificationCleanupService {
constructor(
@InjectRepository(Notification)
private notificationRepo: Repository<Notification>,
private notificationRepo: Repository<Notification>
) {}
/**
@@ -26,10 +26,14 @@ export class NotificationCleanupService {
dateThreshold.setDate(dateThreshold.getDate() - daysAgo);
try {
const result = await this.notificationRepo.delete({
isRead: true,
createdAt: LessThan(dateThreshold),
});
const result = await this.notificationRepo
.createQueryBuilder()
.delete()
.from(Notification)
.where('is_read = :isRead', { isRead: true })
// Use column name 'created_at' explicitly
.andWhere('created_at < :dateThreshold', { dateThreshold })
.execute();
this.logger.log(`Deleted ${result.affected} old read notifications.`);
} catch (error) {