Files
automatisch/packages/backend/src/jobs/remove-cancelled-subscriptions.ee.js
2024-12-20 12:47:14 +01:00

16 lines
363 B
JavaScript

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()
);
};