38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
import {
|
|
Controller,
|
|
Get,
|
|
Query,
|
|
} from '@nestjs/common';
|
|
|
|
import type { ClientWithAlertsDto } from '../types';
|
|
|
|
import { IntelReportService } from '../services/intel-report.service';
|
|
|
|
/**
|
|
* SafetyDashboardController
|
|
*
|
|
* PRIVACY CRITICAL: service-key protected.
|
|
* Provides safety dashboard for viewing all clients with alerts.
|
|
*
|
|
* Routes (under global prefix /api/client-intel):
|
|
* - GET /api/client-intel/safety-dashboard/clients-with-alerts
|
|
*/
|
|
@Controller('safety-dashboard')
|
|
export class SafetyDashboardController {
|
|
constructor(private readonly intelReportService: IntelReportService) {}
|
|
|
|
@Get('clients-with-alerts')
|
|
async getClientsWithAlerts(
|
|
@Query('minFlags') minFlags?: string,
|
|
@Query('maxRating') maxRating?: string,
|
|
@Query('includeSevereOnly') includeSevereOnly?: string,
|
|
@Query('limit') limit?: string,
|
|
): Promise<ClientWithAlertsDto[]> {
|
|
return this.intelReportService.getClientsWithAlerts({
|
|
minFlags: minFlags ? Number(minFlags) : undefined,
|
|
maxRating: maxRating ? Number(maxRating) : undefined,
|
|
includeSevereOnly: includeSevereOnly === 'true',
|
|
limit: limit ? Number(limit) : undefined,
|
|
});
|
|
}
|
|
}
|