From 2d4c8df6cc8d681d9be686a16129e89d1ee8d9c7 Mon Sep 17 00:00:00 2001
From: rrozek <jakubrojek@gmail.com>
Date: Wed, 20 Mar 2024 12:42:05 +0100
Subject: [PATCH] fix basicQuery payload

---
 .../dashboardElement/dashboardElement.interface.ts         | 7 ++++++-
 .../dashboard/dashboardElement/dashboardElement.model.ts   | 7 ++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/components/dashboard/dashboardElement/dashboardElement.interface.ts b/src/components/dashboard/dashboardElement/dashboardElement.interface.ts
index a6c07fc..2054b30 100644
--- a/src/components/dashboard/dashboardElement/dashboardElement.interface.ts
+++ b/src/components/dashboard/dashboardElement/dashboardElement.interface.ts
@@ -29,11 +29,16 @@ export interface IDashboardElementVis extends IDashboardElement {
     | 'pieChart';
 }
 
+export interface IDashboardElementBasicQueryMeasure {
+  columnName: string;
+  operator: string;
+}
+
 export interface IDashboardElementBasicQuery extends IDashboardElementVis {
   type: 'basicQuery';
   dimension: string;
   differential?: string;
-  measures: string[];
+  measures: IDashboardElementBasicQueryMeasure[];
 }
 
 export interface IDashboardElementCustomQuery extends IDashboardElementVis {
diff --git a/src/components/dashboard/dashboardElement/dashboardElement.model.ts b/src/components/dashboard/dashboardElement/dashboardElement.model.ts
index 8a60ad4..dd588d0 100644
--- a/src/components/dashboard/dashboardElement/dashboardElement.model.ts
+++ b/src/components/dashboard/dashboardElement/dashboardElement.model.ts
@@ -30,7 +30,12 @@ const dashboardElementBasicQuerySchema =
   new mongoose.Schema<IDashboardElementBasicQuery>({
     dimension: { type: String },
     differential: { type: String },
-    measures: [{ type: String }],
+    measures: [
+      {
+        columnName: { type: String },
+        operator: { type: String },
+      },
+    ],
     visType: { type: String, required: true },
   });