File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
Minio-SQL-connector/api/services Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff 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 ( ) ] ,
You can’t perform that action at this time.
0 commit comments