pinkmine/src/reports/daily-eccm.report.controller.ts

37 lines
960 B
TypeScript

import { Controller, Get, Query, Render } from '@nestjs/common';
import {
DailyEccmReport,
DailyEccmReportService,
} from './daily-eccm.report.service';
@Controller('daily-eccm')
export class DailyEccmReportController {
constructor(private dailyEccmReportService: DailyEccmReportService) {}
@Get()
@Render('daily-eccm-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: from,
to: to,
reportDate: now,
});
}
@Get('/raw')
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: from,
to: to,
reportDate: now,
});
}
}