From 22f6f53b455cdefac3766ece3261fce12dc84b46 Mon Sep 17 00:00:00 2001 From: Pavel Gnedov Date: Tue, 8 Nov 2022 07:57:21 +0700 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=B8=D1=91=D0=BC=20=D0=BF=D0=B0?= =?UTF-8?q?=D1=80=D0=B0=D0=BC=D0=B5=D1=82=D1=80=D0=BE=D0=B2=20=D0=B8=D0=B7?= =?UTF-8?q?=20url=20=D0=B4=D0=BB=D1=8F=20=D0=B3=D0=B5=D0=BD=D0=B5=D1=80?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D0=B8=20=D0=BE=D1=82=D1=87=D1=91=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/reports/daily-eccm.report.controller.ts | 28 +++++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) 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, }); } }