pdf export
This commit is contained in:
@@ -27,6 +27,8 @@ export type LOGEVENT =
|
||||
| 'penalty_catalog_delete'
|
||||
| 'team_create'
|
||||
| 'team_permissions_update'
|
||||
| 'scheduled_recurring_transaction_check_start'
|
||||
| 'scheduled_recurring_transaction_check_finished'
|
||||
| 'recurring_transaction_create'
|
||||
| 'recurring_transaction_update'
|
||||
| 'recurring_transaction_delete'
|
||||
|
||||
@@ -23,8 +23,18 @@ export class RecurringTransactionsScheduler {
|
||||
private readonly logger: LoggingService,
|
||||
) {}
|
||||
|
||||
@Cron(CronExpression.EVERY_DAY_AT_3AM)
|
||||
@Cron(CronExpression.EVERY_DAY_AT_8AM)
|
||||
async runDueRecurringTransactions(): Promise<void> {
|
||||
const start = Date.now();
|
||||
|
||||
await this.logger.info(
|
||||
{
|
||||
event: 'scheduled_recurring_transaction_check_start',
|
||||
details: `Starting sheduled recurring Transaction check`,
|
||||
userId: -1,
|
||||
},
|
||||
);
|
||||
|
||||
const today = new Date().toISOString();
|
||||
const due = await this.repository.find({
|
||||
where: { active: true, nextRunDate: LessThanOrEqual(today) },
|
||||
@@ -34,6 +44,14 @@ export class RecurringTransactionsScheduler {
|
||||
for (const definition of due) {
|
||||
await this.runOne(definition);
|
||||
}
|
||||
|
||||
await this.logger.info(
|
||||
{
|
||||
event: 'scheduled_recurring_transaction_check_finished',
|
||||
details: `Finished sheduled recurring Transaction check, durationMS=${Date.now() - start}`,
|
||||
userId: -1,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
private async runOne(definition: RecurringTransaction): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user