From 7586312df2c274d9220606e1491718db284ba324 Mon Sep 17 00:00:00 2001 From: Rob Mitchell <40571882+robertandremitchell@users.noreply.github.com> Date: Thu, 12 Dec 2024 09:28:18 -0500 Subject: [PATCH] Small updates to My Query page with update to query table (#209) --- query-connector/src/app/database-service.ts | 20 ++----------------- .../dataState/UserQueriesDisplay.tsx | 3 +-- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/query-connector/src/app/database-service.ts b/query-connector/src/app/database-service.ts index 946c52db..52b05c65 100644 --- a/query-connector/src/app/database-service.ts +++ b/query-connector/src/app/database-service.ts @@ -751,28 +751,12 @@ export async function getCustomQueries(): Promise { * @returns A success or error response indicating the result. */ export const deleteQueryById = async (queryId: string) => { - // TODO: should be able to simplified when it is just deleting query table - const deleteQuerySql1 = ` - DELETE FROM query_included_concepts - WHERE query_by_valueset_id IN ( - SELECT id FROM query_to_valueset WHERE query_id = $1 - ); - `; - const deleteQuerySql2 = ` - DELETE FROM query_to_valueset WHERE query_id = $1; - `; - const deleteQuerySql3 = ` + const deleteQuery = ` DELETE FROM query WHERE id = $1; `; - try { await dbClient.query("BEGIN"); - - // Execute deletion queries in the correct order - await dbClient.query(deleteQuerySql1, [queryId]); - await dbClient.query(deleteQuerySql2, [queryId]); - await dbClient.query(deleteQuerySql3, [queryId]); - + await dbClient.query(deleteQuery, [queryId]); await dbClient.query("COMMIT"); return { success: true }; } catch (error) { diff --git a/query-connector/src/app/queryBuilding/dataState/UserQueriesDisplay.tsx b/query-connector/src/app/queryBuilding/dataState/UserQueriesDisplay.tsx index 58f2a260..f1d5c029 100644 --- a/query-connector/src/app/queryBuilding/dataState/UserQueriesDisplay.tsx +++ b/query-connector/src/app/queryBuilding/dataState/UserQueriesDisplay.tsx @@ -71,8 +71,7 @@ export const UserQueriesDisplay: React.FC = ({ {queries.map((query, index) => ( {query.query_name} - {query.query_name} - {/* TODO: Use conditions_list once available */} + {query.conditions_list}