diff --git a/src/reports/daily-eccm.report.controller.ts b/src/reports/daily-eccm.report.controller.ts index ab3d1eb..8721885 100644 --- a/src/reports/daily-eccm.report.controller.ts +++ b/src/reports/daily-eccm.report.controller.ts @@ -1,4 +1,4 @@ -import { Controller, Get, Logger, Render } from '@nestjs/common'; +import { Controller, Get, Query, Render } from '@nestjs/common'; import { DailyEccmReport, DailyEccmReportService, @@ -8,24 +8,30 @@ import { export class DailyEccmReportController { constructor(private dailyEccmReportService: DailyEccmReportService) {} - // TODO: Заменить хардкоды на параметры - @Get() @Render('daily-eccm-report') - async getReport(): Promise { + async getReport( + @Query('from') from: string, + @Query('to') to: string, + ): Promise { + const now = new Date().toISOString(); return await this.dailyEccmReportService.generateReport({ - from: '2022-09-01T00:00:00+07:00', - to: '2022-11-04T00:00:00+07:00', - reportDate: '', + from: from, + to: to, + reportDate: now, }); } @Get('/raw') - async getReportRawData(): Promise { + async getReportRawData( + @Query('from') from: string, + @Query('to') to: string, + ): Promise { + const now = new Date().toISOString(); return await this.dailyEccmReportService.generateReport({ - from: '2022-09-01T00:00:00+07:00', - to: '2022-11-04T00:00:00+07:00', - reportDate: '', + from: from, + to: to, + reportDate: now, }); } }