// import { TimesheetArchiveService } from "src/time-and-attendance/modules/time-tracker/timesheets/services/timesheet-archive.service"; // import { ExpensesArchivalService } from "src/time-and-attendance/modules/expenses/services/expenses-archival.service"; // import { ShiftsArchivalService } from "src/time-and-attendance/modules/time-tracker/shifts/services/shifts-archival.service"; // import { Injectable, Logger } from "@nestjs/common"; // import { Cron } from "@nestjs/schedule"; // @Injectable() // export class ArchivalService { // private readonly logger = new Logger(ArchivalService.name); // constructor( // private readonly timesheetsService: TimesheetArchiveService, // private readonly expensesService: ExpensesArchivalService, // private readonly shiftsService: ShiftsArchivalService, // ) {} // @Cron('0 0 3 * * 1', {timeZone:'America/Toronto'}) // chaque premier lundi du mois à 03h00 // async handleMonthlyArchival() { // const today = new Date(); // const dayOfMonth = today.getDate(); // if (dayOfMonth > 7) { // this.logger.warn('Archive {awaiting 1st monday of the month for archivation process}') // return; // } // this.logger.log('monthly archivation in process'); // try { // await this.timesheetsService.archiveOld(); // await this.expensesService.archiveOld(); // await this.shiftsService.archiveOld(); // // await this.leaveRequestsService.archiveExpired(); // this.logger.log('archivation process done'); // } catch (err) { // this.logger.error('an error occured during archivation process ', err); // } // } // }