refactor: Extract background jobs to separate files
This commit is contained in:
@@ -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()
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user