Добавлены основные методы в DailyEccmV2ReportService
This commit is contained in:
parent
40313185a5
commit
9c8bea0289
1 changed files with 50 additions and 3 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable, Logger } from '@nestjs/common';
|
||||||
|
|
||||||
export type Params = any; // TODO
|
export type Params = any; // TODO
|
||||||
|
|
||||||
|
|
@ -13,7 +13,54 @@ export type Report = {
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class DailyEccmV2ReportService {
|
export class DailyEccmV2ReportService {
|
||||||
constructor(params: Params) {
|
// TODO: apply logger for all methods
|
||||||
return;
|
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.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue