@@ -23,47 +34,102 @@ import { defineComponent, type PropType } from "vue";
import { mapActions, mapState } from "pinia";
import type { OrderByStructure, OrderByType } from "@/types/dynamicQueries";
import { useQueryBuilderStore } from "@/stores/admin/club/queryBuilder";
-import { TrashIcon } from "@heroicons/vue/24/outline";
+import { TrashIcon, ChevronDownIcon, ChevronUpIcon } from "@heroicons/vue/24/outline";
diff --git a/src/components/queryBuilder/Where.vue b/src/components/queryBuilder/Where.vue
index 51c3ed8..e7db60e 100644
--- a/src/components/queryBuilder/Where.vue
+++ b/src/components/queryBuilder/Where.vue
@@ -5,6 +5,7 @@
(value[index] = $event)"
@@ -12,6 +13,7 @@
/>
(value[index] = $event)"
@@ -74,14 +76,14 @@ export default defineComponent({
addNestedToValue() {
this.value.push({
structureType: "nested",
- concat: this.value.length == 0 ? "_" : "AND",
+ concat: "AND",
conditions: [],
});
},
addConditionToValue() {
this.value.push({
structureType: "condition",
- concat: this.value.length == 0 ? "_" : "AND",
+ concat: "AND",
operation: "eq",
column: "",
value: "",
diff --git a/src/types/dynamicQueries.ts b/src/types/dynamicQueries.ts
index dfe3e09..adf4190 100644
--- a/src/types/dynamicQueries.ts
+++ b/src/types/dynamicQueries.ts
@@ -1,9 +1,10 @@
export interface DynamicQueryStructure {
+ id: string;
select: string[] | "*";
table: string;
where?: Array;
join?: Array;
- orderBy?: Array;
+ orderBy?: Array; // only at top level
}
export type ConditionStructure = (
@@ -48,6 +49,9 @@ export type WhereOperation =
// TODO: age between | age equals | age greater | age smaller
export type OrderByStructure = {
+ id: string;
+ depth: number;
+ table: string;
column: string;
order: OrderByType;
};