Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | 1x 1x 1x 1x 21x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import { Controller, Get, Post, Put, Body, Param, Query, UseGuards } from '@nestjs/common';
import { AnalyticsService } from './analytics.service';
import { JwtAuthGuard } from '../../platform/auth/jwt-auth.guard';
@Controller('api/v1/analytics')
@UseGuards(JwtAuthGuard)
export class AnalyticsController {
constructor(private readonly analyticsService: AnalyticsService) {}
@Get('configuration')
async getConfiguration(@Query('tenantId') tenantId: string) {
return this.analyticsService.getConfiguration(tenantId);
}
@Post('kpis')
async configureKpi(@Query('tenantId') tenantId: string, @Body() body: any) {
return this.analyticsService.configureKpi(tenantId, body);
}
@Get('kpis/:code/evaluate')
async evaluateKpi(
@Param('code') kpiCode: string,
@Query('tenantId') tenantId: string,
@Query('value') valueStr: string
) {
const val = parseFloat(valueStr) || 0;
return this.analyticsService.evaluateKpiStatus(tenantId, kpiCode, val);
}
@Post('kpis/:code/forecast')
async calculateForecast(
@Param('code') kpiCode: string,
@Query('tenantId') tenantId: string,
@Body() body: any
) {
return this.analyticsService.calculateForecast(tenantId, kpiCode, body.historicalValues || []);
}
@Post('cubes/increment')
async incrementCube(@Query('tenantId') tenantId: string, @Body() body: any) {
return this.analyticsService.incrementCubeFact(tenantId, body);
}
@Post('reports')
async saveReport(@Query('tenantId') tenantId: string, @Body() body: any) {
return this.analyticsService.saveReport(tenantId, body);
}
@Post('subscriptions')
async createSubscription(@Query('tenantId') tenantId: string, @Body() body: any) {
return this.analyticsService.createSubscription(tenantId, body);
}
@Post('ai/query')
async parseAiQuery(@Query('tenantId') tenantId: string, @Body() body: any) {
return this.analyticsService.parseNaturalLanguageQuery(tenantId, body.naturalQuery);
}
}
|