Run Click house ... test 1

main 1.0.0
DenisN 2025-09-19 09:39:25 -04:00
parent ffb7a521a6
commit 1a622c140d
3 changed files with 28 additions and 2 deletions

View File

@ -132,12 +132,13 @@ export class ClickhouseService {
// for (let query of insertQuery) {
try{
let retRaw = await connectionData.query(insertRawQuery).toPromise();
console.log(retRaw);
}
catch{
console.log(insertRawQuery);
}
// console.log(retRaw);
// }
// console.log(retRaw);
// }
break;
case 'complex':
let insertComplexQuery = 'INSERT INTO complex_parameters VALUES(toDateTime(now()), \'{{parameterBody}}\', toDateTime(now()));';

View File

@ -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);

View File

@ -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 = {