diff --git a/query-connector/src/app/database-service.ts b/query-connector/src/app/database-service.ts index 2d162d09..153960cd 100644 --- a/query-connector/src/app/database-service.ts +++ b/query-connector/src/app/database-service.ts @@ -741,28 +741,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}