import { Body, ConfigurableModuleBuilder, Controller, Get, Options, Param, ParseIntPipe, Post} from '@nestjs/common'; import { ZvksmetricsService } from './zvksmetrics.service'; @Controller('api') export class ZvksmetricsController { constructor(private readonly metricsService: ZvksmetricsService) {} @Get('ranges') async getHello(): Promise { let a: number = 7; let b: number = 9; let sum: any = {value: (a+b)/4*b+a}; // let a = await this.metricsService.showStatus(); console.log(sum.value); return sum.value; } //Заглушка для будующей API @Options('config/:code') async showConfig (@Param('code', ParseIntPipe) code: number): Promise{ let ret : JSON = JSON.parse('{"result":"null"}'); if(code === 9999){ return await this.metricsService.showRangesConfig('File Name'); } return ret; } @Post('input') async getPostMessage (@Body() inputMetrics : any) : Promise { //console.log(inputMetrics); let out: any = await this.metricsService.useStatusModel(inputMetrics); return out; } }