refactor: Extract background jobs to separate files

This commit is contained in:
Faruk AYDIN
2024-12-19 13:26:36 +01:00
parent 85397c3802
commit bc6314ac7e
6 changed files with 215 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
import { DateTime } from 'luxon';
import Subscription from '../models/subscription.ee.js';
export const removeCancelledSubscriptionsJob = async () => {
await Subscription.query()
.delete()
.where({
status: 'deleted',
})
.andWhere(
'cancellation_effective_date',
'<=',
DateTime.now().startOf('day').toISODate()
);
};