Приём параметров из 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 {
|
||||
DailyEccmReport,
|
||||
DailyEccmReportService,
|
||||
|
|
@ -8,24 +8,30 @@ import {
|
|||
export class DailyEccmReportController {
|
||||
constructor(private dailyEccmReportService: DailyEccmReportService) {}
|
||||
|
||||
// TODO: Заменить хардкоды на параметры
|
||||
|
||||
@Get()
|
||||
@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({
|
||||
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<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({
|
||||
from: '2022-09-01T00:00:00+07:00',
|
||||
to: '2022-11-04T00:00:00+07:00',
|
||||
reportDate: '',
|
||||
from: from,
|
||||
to: to,
|
||||
reportDate: now,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue