mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 15:30:56 +00:00
33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
import { Body, Controller, Get, Param, Post, Query } from '@nestjs/common';
|
|
import { ApiTags, ApiOperation, ApiBearerAuth } from '@nestjs/swagger';
|
|
import { ReportsService } from './reports.service';
|
|
import { GenerateReportDto } from './reports.dto';
|
|
import { PassengerStaff } from '../../common/passenger-guards';
|
|
import { PASSENGER_PERMS } from '../../seed/passenger-permissions.registry';
|
|
|
|
@ApiTags('Reports')
|
|
@Controller('reports')
|
|
@PassengerStaff([PASSENGER_PERMS.reports.view, PASSENGER_PERMS.admin])
|
|
@ApiBearerAuth('IAM-auth')
|
|
export class ReportsController {
|
|
constructor(private service: ReportsService) {}
|
|
|
|
@Post('generate')
|
|
@ApiOperation({ summary: 'Generate operational report' })
|
|
generateReport(@Body() dto: GenerateReportDto) {
|
|
return this.service.generateReport(dto);
|
|
}
|
|
|
|
@Get(':reportId')
|
|
@ApiOperation({ summary: 'Get report by ID' })
|
|
getReport(@Param('reportId') reportId: string) {
|
|
return this.service.getReport(reportId);
|
|
}
|
|
|
|
@Get()
|
|
@ApiOperation({ summary: 'List reports' })
|
|
listReports(@Query('type') type?: string) {
|
|
return this.service.listReports(type);
|
|
}
|
|
}
|