diff --git a/src/reports/daily-eccm-v2.report.service.ts b/src/reports/daily-eccm-v2.report.service.ts index fc2150d..caaefe7 100644 --- a/src/reports/daily-eccm-v2.report.service.ts +++ b/src/reports/daily-eccm-v2.report.service.ts @@ -1,4 +1,4 @@ -import { Injectable } from '@nestjs/common'; +import { Injectable, Logger } from '@nestjs/common'; export type Params = any; // TODO @@ -13,7 +13,54 @@ export type Report = { @Injectable() export class DailyEccmV2ReportService { - constructor(params: Params) { - return; + // TODO: apply logger for all methods + private logger = new Logger(DailyEccmV2ReportService.name); + + private jobs: any[] = []; + + addJob(job: any) { + this.jobs.push(job); + } + + getJobs() { + return this.jobs; + } + + getJob(jobId: string) { + return this.jobs.find((job) => job.id === jobId); + } + + removeJob(jobId: string) { + this.jobs.splice(this.jobs.indexOf(jobId), 1); + } + + startAllJobs() { + this.jobs.forEach((job) => { + job.start(); + }); + } + + startJob(jobId: string) { + const job = this.getJob(jobId); + if (job) { + job.start(); + } + } + + stopAllJobs() { + this.jobs.forEach((job) => { + job.stop(); + }); + } + + stopJob(jobId: string) { + const job = this.getJob(jobId); + if (job) { + job.stop(); + } + } + + autoScanJobs() { + throw new Error('Method not implemented.'); } }