From 60ed850d2dc3b863183291312b74b4c2e311200a Mon Sep 17 00:00:00 2001 From: "D. Berge" Date: Mon, 21 Aug 2023 14:46:51 +0200 Subject: [PATCH] Change db.configuration.get() to use database. NOTE: this endpoint is redundant with db.project.configuration.get() except for its ability to return a partial tree. TODO: merge this with db.project.configuration.get(). --- lib/www/server/lib/db/configuration/get.js | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/lib/www/server/lib/db/configuration/get.js b/lib/www/server/lib/db/configuration/get.js index 834f4a1..6c92821 100644 --- a/lib/www/server/lib/db/configuration/get.js +++ b/lib/www/server/lib/db/configuration/get.js @@ -1,17 +1,9 @@ -const { setSurvey } = require('../connection'); +const { setSurvey, pool } = require('../connection'); async function get (projectId, path, opts = {}) { - const client = await setSurvey(projectId); - const text = ` - SELECT data - FROM file_data fd - INNER JOIN files f USING (hash) - WHERE f.path LIKE '%.yaml'; - `; - - const res = await client.query(text); - client.release(); + const text = `SELECT meta FROM public.projects WHERE pid = $1;`; + const res = await pool.query(text, [projectId]); const config = res.rows.length == 1 ? res.rows[0].data