Proper fix, making sure that low level handling of JSON column types correctly handles aliasing.
This commit is contained in:
parent
612efba370
commit
6a0e46a0a6
|
@ -705,10 +705,13 @@ class SqlQueryBuilder extends SqlTableQueryBuilder {
|
||||||
if (!this._isJsonColumn(field)) {
|
if (!this._isJsonColumn(field)) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
const fullName = `${table.name}.${name}`
|
|
||||||
for (let row of results) {
|
for (let row of results) {
|
||||||
if (typeof row[fullName] === "string") {
|
const columnNames = Object.keys(row)
|
||||||
row[fullName] = JSON.parse(row[fullName])
|
const fullColumnName = columnNames.find(
|
||||||
|
column => column.includes(`.${name}`) || column === name
|
||||||
|
)
|
||||||
|
if (fullColumnName && typeof row[fullColumnName] === "string") {
|
||||||
|
row[fullColumnName] = JSON.parse(row[fullColumnName])
|
||||||
}
|
}
|
||||||
if (typeof row[name] === "string") {
|
if (typeof row[name] === "string") {
|
||||||
row[name] = JSON.parse(row[name])
|
row[name] = JSON.parse(row[name])
|
||||||
|
|
|
@ -68,16 +68,8 @@ export async function processOutputBBReferences(
|
||||||
return value || undefined
|
return value || undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
let ids: string[] = []
|
const ids =
|
||||||
if (typeof value === "string") {
|
typeof value === "string" ? value.split(",").filter(id => !!id) : value
|
||||||
try {
|
|
||||||
ids = JSON.parse(value)
|
|
||||||
} catch (err) {
|
|
||||||
ids = value.split(",").filter(id => !!id)
|
|
||||||
}
|
|
||||||
} else if (Array.isArray(value)) {
|
|
||||||
ids = value
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (subtype) {
|
switch (subtype) {
|
||||||
case FieldSubtype.USER:
|
case FieldSubtype.USER:
|
||||||
|
|
Loading…
Reference in New Issue