Приём параметров из url для генерации отчёта
This commit is contained in:
parent
7d94350ae0
commit
22f6f53b45
1 changed files with 17 additions and 11 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
import { Controller, Get, Logger, Render } from '@nestjs/common';
|
import { Controller, Get, Query, Render } from '@nestjs/common';
|
||||||
import {
|
import {
|
||||||
DailyEccmReport,
|
DailyEccmReport,
|
||||||
DailyEccmReportService,
|
DailyEccmReportService,
|
||||||
|
|
@ -8,24 +8,30 @@ import {
|
||||||
export class DailyEccmReportController {
|
export class DailyEccmReportController {
|
||||||
constructor(private dailyEccmReportService: DailyEccmReportService) {}
|
constructor(private dailyEccmReportService: DailyEccmReportService) {}
|
||||||
|
|
||||||
// TODO: Заменить хардкоды на параметры
|
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
@Render('daily-eccm-report')
|
@Render('daily-eccm-report')
|
||||||
async getReport(): Promise<DailyEccmReport.Models.Report> {
|
async getReport(
|
||||||
|
@Query('from') from: string,
|
||||||
|
@Query('to') to: string,
|
||||||
|
): Promise<DailyEccmReport.Models.Report> {
|
||||||
|
const now = new Date().toISOString();
|
||||||
return await this.dailyEccmReportService.generateReport({
|
return await this.dailyEccmReportService.generateReport({
|
||||||
from: '2022-09-01T00:00:00+07:00',
|
from: from,
|
||||||
to: '2022-11-04T00:00:00+07:00',
|
to: to,
|
||||||
reportDate: '',
|
reportDate: now,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get('/raw')
|
@Get('/raw')
|
||||||
async getReportRawData(): Promise<DailyEccmReport.Models.Report> {
|
async getReportRawData(
|
||||||
|
@Query('from') from: string,
|
||||||
|
@Query('to') to: string,
|
||||||
|
): Promise<DailyEccmReport.Models.Report> {
|
||||||
|
const now = new Date().toISOString();
|
||||||
return await this.dailyEccmReportService.generateReport({
|
return await this.dailyEccmReportService.generateReport({
|
||||||
from: '2022-09-01T00:00:00+07:00',
|
from: from,
|
||||||
to: '2022-11-04T00:00:00+07:00',
|
to: to,
|
||||||
reportDate: '',
|
reportDate: now,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue