Skip to content

Commit

Permalink
Add impact report service and controller scaffold
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeh committed Dec 14, 2023
1 parent 305a161 commit a4923f2
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
13 changes: 13 additions & 0 deletions api/src/modules/impact/impact-report.controller.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Controller } from '@nestjs/common';
import { ImpactService } from 'modules/impact/impact.service';
import { ActualVsScenarioImpactService } from 'modules/impact/comparison/actual-vs-scenario.service';
import { ScenarioVsScenarioImpactService } from 'modules/impact/comparison/scenario-vs-scenario.service';

@Controller('/api/v1/impact')
export class ImpactReportController {
constructor(
private readonly impactService: ImpactService,
private readonly actualVsScenarioImpactService: ActualVsScenarioImpactService,
private readonly scenarioVsScenarioService: ScenarioVsScenarioImpactService,
) {}
}
3 changes: 2 additions & 1 deletion api/src/modules/impact/impact.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { AuthorizationModule } from 'modules/authorization/authorization.module'
import { ImpactViewUpdater } from 'modules/impact/views/impact-view.updater';
import { BaseImpactService } from 'modules/impact/base-impact.service';
import { ImpactRepository } from 'modules/impact/impact.repository';
import { ImpactReportController } from './impact-report.controller';

@Module({
imports: [
Expand All @@ -36,7 +37,7 @@ import { ImpactRepository } from 'modules/impact/impact.repository';
MaterialsService,
ImpactViewUpdater,
],
controllers: [ImpactController],
controllers: [ImpactController, ImpactReportController],
exports: [
ImpactService,
ActualVsScenarioImpactService,
Expand Down
17 changes: 17 additions & 0 deletions api/src/modules/impact/impact.report.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Inject, Injectable } from '@nestjs/common';
import { IReportService } from 'modules/reports/report-service.interface';
import { ReportServiceToken } from 'modules/reports/reports.module';

@Injectable()
export class ImpactReportService {
constructor(
@Inject(ReportServiceToken) private reportService: IReportService,
) {}

async generateImpactReport(data: any): Promise<string> {
const parserOptions: { fields: ['line', 'error'] } = {
fields: ['line', 'error'],
};
return this.reportService.generateReport(data, {});
}
}

0 comments on commit a4923f2

Please sign in to comment.