zet-lib 1.2.26 → 1.2.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/connection.js +16 -2
- package/lib/index.js +2 -0
- package/package.json +5 -5
package/lib/connection.js
CHANGED
|
@@ -73,6 +73,8 @@ const whereFn = (obj) => {
|
|
|
73
73
|
arr.push(where[key])
|
|
74
74
|
increment++
|
|
75
75
|
}
|
|
76
|
+
//console.log(whereArray);
|
|
77
|
+
let hasWhere = false
|
|
76
78
|
wherequery = arr.length ? wherequery.join(' AND ') : ''
|
|
77
79
|
if (whereArray.length) {
|
|
78
80
|
let andOr = wherequery ? ' AND ' : ''
|
|
@@ -95,9 +97,11 @@ const whereFn = (obj) => {
|
|
|
95
97
|
//JSON_CONTAINS(color, '"Red"' ,'$')
|
|
96
98
|
if (item.isJSON) {
|
|
97
99
|
wherequery += andOr + ` JSON_CONTAINS(${field}, '"${item.value}"' ,'$') ${operator}`
|
|
100
|
+
hasWhere = true
|
|
98
101
|
} else {
|
|
99
102
|
if (type == 'json') {
|
|
100
103
|
wherequery += andOr + ` JSON_CONTAINS(${field}, '"${item.value}"' ,'$') ${operator}`
|
|
104
|
+
hasWhere = true
|
|
101
105
|
} else if (type == 'inline') {
|
|
102
106
|
//select * from attendance where employee_id = 4803 and date IN ('2023-12-21','2023-12-22')
|
|
103
107
|
if (field) {
|
|
@@ -105,6 +109,7 @@ const whereFn = (obj) => {
|
|
|
105
109
|
} else {
|
|
106
110
|
wherequery += andOr + ` ${item.value} ${operator}`
|
|
107
111
|
}
|
|
112
|
+
hasWhere = true
|
|
108
113
|
} else {
|
|
109
114
|
if (item.option.includes('{{value}}')) {
|
|
110
115
|
item.option = item.option.replace('{{value}}', `$${increment}`)
|
|
@@ -127,12 +132,21 @@ const whereFn = (obj) => {
|
|
|
127
132
|
})
|
|
128
133
|
//console.log(arr)
|
|
129
134
|
}
|
|
130
|
-
|
|
131
|
-
|
|
135
|
+
if (arr.length > 0) {
|
|
136
|
+
hasWhere = true
|
|
137
|
+
}
|
|
138
|
+
let wheres = ''
|
|
139
|
+
if (hasWhere) {
|
|
140
|
+
wheres = `WHERE ${wherequery}`
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
let objAll = {
|
|
132
144
|
where: wheres,
|
|
133
145
|
arr: arr,
|
|
134
146
|
increment: increment,
|
|
135
147
|
}
|
|
148
|
+
//console.log(obj)
|
|
149
|
+
return objAll
|
|
136
150
|
}
|
|
137
151
|
|
|
138
152
|
connection.results = async (obj) => {
|
package/lib/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zet-lib",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.28",
|
|
4
4
|
"description": "zet is a library that part of zet generator.",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=18"
|
|
@@ -28,15 +28,15 @@
|
|
|
28
28
|
},
|
|
29
29
|
"sideEffects": false,
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"axios": "^1.
|
|
31
|
+
"axios": "^1.6.8",
|
|
32
32
|
"convert-excel-to-json": "^1.7.0",
|
|
33
33
|
"dotenv": "^16.3.1",
|
|
34
34
|
"ejs": "^3.1.9",
|
|
35
|
-
"exceljs": "^4.
|
|
35
|
+
"exceljs": "^4.4.0",
|
|
36
36
|
"fs-extra": "^11.1.1",
|
|
37
37
|
"html-minifier-terser": "^7.2.0",
|
|
38
38
|
"js-sha256": "^0.9.0",
|
|
39
|
-
"moment": "^2.
|
|
39
|
+
"moment": "^2.30.1",
|
|
40
40
|
"node-cache": "^5.1.2",
|
|
41
41
|
"nodemailer": "^6.9.4",
|
|
42
42
|
"pg": "^8.11.2",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"randomstring": "^1.3.0",
|
|
48
48
|
"socket.io": "^4.7.5",
|
|
49
49
|
"uglify-js": "^3.17.4",
|
|
50
|
-
"uuid": "^9.0.
|
|
50
|
+
"uuid": "^9.0.1",
|
|
51
51
|
"xlsx": "^0.18.5"
|
|
52
52
|
}
|
|
53
53
|
}
|