Skip to content

Commit 7b613b5

Browse files
committed
fix bug
1 parent c8e654a commit 7b613b5

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

Minio-SQL-connector/api/services/service.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,23 @@ async function sync() {
136136
}
137137
}
138138

139-
let valuesToDB = entries.map(obj => ({
139+
let valuesToDB = []
140+
141+
//console.log(entries)
142+
for (let entry of entries)
143+
for (let key in entry)
144+
for (let subKeyAliasValue in entry[key]) {
145+
let existingEntry = valuesToDB.find(v => v.value === subKeyAliasValue)
146+
if (existingEntry)
147+
existingEntry.visibility = [...new Set([...existingEntry.visibility, ...entry[key][subKeyAliasValue]])]
148+
else
149+
valuesToDB.push({ value: subKeyAliasValue, visibility: entry[key][subKeyAliasValue] })
150+
}
151+
152+
/*let valuesToDB = entries.map(obj => ({
140153
visibility: obj[Object.keys(obj).pop()][Object.keys(obj[Object.keys(obj).pop()]).pop()],
141154
value: Object.keys(obj[Object.keys(obj).pop()]).pop()
142-
}))
155+
}))*/
143156
let keysToDB = entries.map(obj => ({
144157
key: Object.keys(obj).pop() || "flag_error_key_missing",
145158
visibility: obj[Object.keys(obj).pop()][Object.keys(obj[Object.keys(obj).pop()]).pop()],

0 commit comments

Comments
 (0)