modified: backend/src/services/AqlExecutor.ts
This commit is contained in:
@@ -195,25 +195,10 @@ export class AqlExecutor {
|
||||
throw new Error(`Invalid JSON response: ${responseText.substring(0, 200)}`);
|
||||
}
|
||||
|
||||
// Нормализуем ответ к формату QueryResult
|
||||
let rows: any[];
|
||||
let rowCount: number;
|
||||
|
||||
if (Array.isArray(data)) {
|
||||
rows = data;
|
||||
rowCount = data.length;
|
||||
} else if (data && typeof data === 'object') {
|
||||
// Если ответ - объект, оборачиваем его в массив
|
||||
rows = [data];
|
||||
rowCount = 1;
|
||||
} else {
|
||||
rows = [];
|
||||
rowCount = 0;
|
||||
}
|
||||
|
||||
// Возвращаем данные как есть
|
||||
return {
|
||||
rows,
|
||||
rowCount,
|
||||
rows: data,
|
||||
rowCount: Array.isArray(data) ? data.length : (data ? 1 : 0),
|
||||
executionTime,
|
||||
};
|
||||
} catch (error: any) {
|
||||
|
||||
Reference in New Issue
Block a user