parent
ffb7a521a6
commit
1a622c140d
|
|
@ -132,6 +132,7 @@ export class ClickhouseService {
|
|||
// for (let query of insertQuery) {
|
||||
try{
|
||||
let retRaw = await connectionData.query(insertRawQuery).toPromise();
|
||||
console.log(retRaw);
|
||||
}
|
||||
catch{
|
||||
console.log(insertRawQuery);
|
||||
|
|
|
|||
|
|
@ -66,6 +66,15 @@ export class ZvksmetricsController {
|
|||
return ret;
|
||||
}
|
||||
|
||||
@Post('formulas/:code')
|
||||
async setFormulas(@Body() inputFormulas: any, @Param('code', ParseIntPipe) code: number): Promise<string> {
|
||||
let ret: string = "Controller Error";
|
||||
if (code === 1111) {
|
||||
return await this.metricsService.saveFormulas(inputFormulas);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Post('input')
|
||||
async getPostMessage(@Body() inputMetrics: any): Promise<string> {
|
||||
// console.log(inputMetrics);
|
||||
|
|
|
|||
|
|
@ -379,6 +379,22 @@ export class ZvksmetricsService {
|
|||
return ret;
|
||||
}
|
||||
|
||||
async saveFormulas(inputFormulas: string): Promise<any> {
|
||||
let ret: any;
|
||||
let filePath: any = process.env.FORMULAS_CONFIG;
|
||||
// console.log(inputRanges);
|
||||
let inp: string = JSON.stringify(inputFormulas);
|
||||
try {
|
||||
await writeFile(filePath, inp);
|
||||
ret = "200 OK";
|
||||
}
|
||||
catch {
|
||||
ret = "Error write file";
|
||||
console.log(ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
async setComplexMetrics(@Body() complexData: any = null): Promise<MetricsCalculation[]> {
|
||||
let url: any = process.env.COMPLEX_METRICS;
|
||||
let options: any = {
|
||||
|
|
|
|||
Loading…
Reference in New Issue