import { Injectable } from '@nestjs/common'; import { BackupSchedulerService } from '../backup/backup-scheduler.service'; import { Job, JobResult } from './job'; import { JobName } from './job-names'; /** * The hourly CronJob check of the automatic backup: writes a backup only if * the schedule (env or GUI, Europe/Berlin) says one is due. Without a * configured path it succeeds without writing; a failed backup fails the * run, which notifies the holders of backup:configure. */ @Injectable() export class AppBackupJob implements Job { readonly name: JobName = 'app-backup'; constructor(private readonly scheduler: BackupSchedulerService) {} run(): Promise { return this.scheduler.runIfDue(); } }