From a9cd987c50de7d49bb82cc1b4b9de3c449659630 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Thu, 7 Sep 2023 23:40:20 +0200 Subject: [javascript] Fixed database functions result which were not parsed --- nodejs/database/agents.js | 2 +- nodejs/database/contracts.js | 2 +- nodejs/database/surveys.js | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) (limited to 'nodejs/database') diff --git a/nodejs/database/agents.js b/nodejs/database/agents.js index fe24d8c..4dd7f4b 100644 --- a/nodejs/database/agents.js +++ b/nodejs/database/agents.js @@ -12,5 +12,5 @@ export function getAgent() { if (data === undefined) { return null; } - return data.data; + return JSON.parse(data.data); } diff --git a/nodejs/database/contracts.js b/nodejs/database/contracts.js index 8790701..ac583de 100644 --- a/nodejs/database/contracts.js +++ b/nodejs/database/contracts.js @@ -9,7 +9,7 @@ export function getContract(id) { if (data === undefined) { return null; } - return data.data; + return JSON.parse(data.data); } export function setContract(data) { diff --git a/nodejs/database/surveys.js b/nodejs/database/surveys.js index 60c85b2..3397374 100644 --- a/nodejs/database/surveys.js +++ b/nodejs/database/surveys.js @@ -10,7 +10,8 @@ export function deleteExpired() { export function get(symbol) { deleteExpired(); - return getSurveysStatement.all(symbol); + const data = getSurveysStatement.all(symbol); + return data.map(elt => JSON.parse(elt.data)); } export function set(survey) { -- cgit v1.2.3