mirror of
https://github.com/sussy-code/backend.git
synced 2026-04-20 16:32:03 +00:00
15 lines
336 B
TypeScript
15 lines
336 B
TypeScript
import { Session } from '@/db/models/Session';
|
|
import { job } from '@/modules/jobs/job';
|
|
|
|
// every day at 12:00:00
|
|
export const sessionExpiryJob = job('0 12 * * *', async ({ em }) => {
|
|
await em
|
|
.createQueryBuilder(Session)
|
|
.delete()
|
|
.where({
|
|
expiresAt: {
|
|
$lt: new Date(),
|
|
},
|
|
})
|
|
.execute();
|
|
});
|