forked from FoundKeyGang/FoundKey
server: expire notifications after 3 months
closes FoundKeyGang/FoundKey#292 Changelog: Added
This commit is contained in:
parent
fc36bb8880
commit
9317d25078
1 changed files with 6 additions and 1 deletions
|
@ -1,6 +1,6 @@
|
||||||
import Bull from 'bull';
|
import Bull from 'bull';
|
||||||
import { In, LessThan } from 'typeorm';
|
import { In, LessThan } from 'typeorm';
|
||||||
import { AttestationChallenges, AuthSessions, Mutings, PasswordResetRequests, Signins } from '@/models/index.js';
|
import { AttestationChallenges, AuthSessions, Mutings, Notifications, PasswordResetRequests, Signins } from '@/models/index.js';
|
||||||
import { publishUserEvent } from '@/services/stream.js';
|
import { publishUserEvent } from '@/services/stream.js';
|
||||||
import { MINUTE, DAY, MONTH } from '@/const.js';
|
import { MINUTE, DAY, MONTH } from '@/const.js';
|
||||||
import { queueLogger } from '@/queue/logger.js';
|
import { queueLogger } from '@/queue/logger.js';
|
||||||
|
@ -47,6 +47,11 @@ export async function checkExpired(job: Bull.Job<Record<string, unknown>>, done:
|
||||||
createdAt: OlderThan(15 * MINUTE),
|
createdAt: OlderThan(15 * MINUTE),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await Notifications.delete({
|
||||||
|
isRead: true,
|
||||||
|
createdAt: OlderThan(3 * MONTH),
|
||||||
|
});
|
||||||
|
|
||||||
logger.succ('Deleted expired data.');
|
logger.succ('Deleted expired data.');
|
||||||
|
|
||||||
done();
|
done();
|
||||||
|
|
Loading…
Reference in a new issue