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,6 +132,7 @@ export class ClickhouseService {
// for (let query of insertQuery) { // for (let query of insertQuery) {
try{ try{
let retRaw = await connectionData.query(insertRawQuery).toPromise(); let retRaw = await connectionData.query(insertRawQuery).toPromise();
console.log(retRaw);
} }
catch{ catch{
console.log(insertRawQuery); console.log(insertRawQuery);

View File

@ -66,6 +66,15 @@ export class ZvksmetricsController {
return ret; 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') @Post('input')
async getPostMessage(@Body() inputMetrics: any): Promise<string> { async getPostMessage(@Body() inputMetrics: any): Promise<string> {
// console.log(inputMetrics); // console.log(inputMetrics);

View File

@ -379,6 +379,22 @@ export class ZvksmetricsService {
return ret; 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[]> { async setComplexMetrics(@Body() complexData: any = null): Promise<MetricsCalculation[]> {
let url: any = process.env.COMPLEX_METRICS; let url: any = process.env.COMPLEX_METRICS;
let options: any = { let options: any = {