From f40a4acad11c6ef93ab4441e5d11478b6aa7a41b Mon Sep 17 00:00:00 2001 From: Blake Matthes Date: Tue, 13 Jan 2026 17:56:43 -0600 Subject: [PATCH] refactor(datamart): refactored the get queries to only send back info not the entire query --- backend/src/datamart/datamart.controller.ts | 3 ++- backend/src/datamart/datamart.routes.ts | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/backend/src/datamart/datamart.controller.ts b/backend/src/datamart/datamart.controller.ts index 4625323..d69208f 100644 --- a/backend/src/datamart/datamart.controller.ts +++ b/backend/src/datamart/datamart.controller.ts @@ -46,8 +46,9 @@ export const runDatamartQuery = async (data: Data) => { // create the query with no changed just to have it here let datamartQuery = queryInfo[0]?.query || ""; + // split the criteria by "," then and then update the query - if (data.options) { + if (data.options !== "") { const params = new URLSearchParams(data.options); for (const [rawKey, rawValue] of params.entries()) { diff --git a/backend/src/datamart/datamart.routes.ts b/backend/src/datamart/datamart.routes.ts index 338c5fc..c672085 100644 --- a/backend/src/datamart/datamart.routes.ts +++ b/backend/src/datamart/datamart.routes.ts @@ -17,7 +17,13 @@ export const setupDatamartRoutes = (baseUrl: string, app: Express) => { // just sending a get on datamart will return all the queries that we can call. app.get(`${baseUrl}/api/datamart`, async (_, res) => { const queries = await db - .select() + .select({ + name: datamart.name, + description: datamart.description, + options: datamart.options, + version: datamart.version, + upd_date: datamart.upd_date, + }) .from(datamart) .where(eq(datamart.active, true));