refactor(datamart): refactored the get queries to only send back info not the entire query
This commit is contained in:
@@ -46,8 +46,9 @@ export const runDatamartQuery = async (data: Data) => {
|
|||||||
|
|
||||||
// create the query with no changed just to have it here
|
// create the query with no changed just to have it here
|
||||||
let datamartQuery = queryInfo[0]?.query || "";
|
let datamartQuery = queryInfo[0]?.query || "";
|
||||||
|
|
||||||
// split the criteria by "," then and then update the query
|
// split the criteria by "," then and then update the query
|
||||||
if (data.options) {
|
if (data.options !== "") {
|
||||||
const params = new URLSearchParams(data.options);
|
const params = new URLSearchParams(data.options);
|
||||||
|
|
||||||
for (const [rawKey, rawValue] of params.entries()) {
|
for (const [rawKey, rawValue] of params.entries()) {
|
||||||
|
|||||||
@@ -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.
|
// just sending a get on datamart will return all the queries that we can call.
|
||||||
app.get(`${baseUrl}/api/datamart`, async (_, res) => {
|
app.get(`${baseUrl}/api/datamart`, async (_, res) => {
|
||||||
const queries = await db
|
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)
|
.from(datamart)
|
||||||
.where(eq(datamart.active, true));
|
.where(eq(datamart.active, true));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user