46 lines
1.6 KiB
TypeScript
46 lines
1.6 KiB
TypeScript
import { Controller, Get, UseGuards } from '@nestjs/common';
|
|
import { ApiTags, ApiOperation, ApiResponse } from '@nestjs/swagger';
|
|
import { DashboardService } from './dashboard.service';
|
|
import { PermissionsGuard } from '../auth/guards/permissions.guard';
|
|
import { RequirePermissions } from '../auth/decorators/permissions.decorator';
|
|
|
|
@ApiTags('Dashboard')
|
|
@Controller('dashboard')
|
|
@UseGuards(PermissionsGuard)
|
|
export class DashboardController {
|
|
constructor(private readonly dashboardService: DashboardService) {}
|
|
|
|
@Get('metrics')
|
|
@RequirePermissions('dashboard:view')
|
|
@ApiOperation({ summary: 'Get dashboard summary metrics' })
|
|
@ApiResponse({ status: 200, description: 'Return 5 aggregated metric cards for dashboard' })
|
|
getMetrics() {
|
|
return this.dashboardService.getMetrics();
|
|
}
|
|
|
|
@Get('exposure')
|
|
@RequirePermissions('dashboard:view')
|
|
@ApiOperation({ summary: 'Get refund and compensation exposure data' })
|
|
@ApiResponse({ status: 200, description: 'Return exposure category metrics' })
|
|
getExposure() {
|
|
return this.dashboardService.getExposure();
|
|
}
|
|
|
|
@Get('disruption-mix')
|
|
@RequirePermissions('dashboard:view')
|
|
@ApiOperation({ summary: 'Get disruption mix breakdown' })
|
|
@ApiResponse({ status: 200, description: 'Return disruption mix category breakdown' })
|
|
getDisruptionMix() {
|
|
return this.dashboardService.getDisruptionMix();
|
|
}
|
|
|
|
@Get('recent-incidents')
|
|
@RequirePermissions('dashboard:view')
|
|
@ApiOperation({ summary: 'Get recent recovery incidents for dashboard' })
|
|
@ApiResponse({ status: 200, description: 'Return recent incident rows' })
|
|
getRecentIncidents() {
|
|
return this.dashboardService.getRecentIncidents();
|
|
}
|
|
}
|
|
|