Updating variable naming in table fetch function to match more with what is actually being retrieved.
This commit is contained in:
parent
662a0cdd39
commit
5c46ef2ff4
|
@ -32,8 +32,8 @@ exports.fetch = async function (ctx) {
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
const internal = internalTables.rows.map(row => ({
|
const internal = internalTables.rows.map(tableDoc => ({
|
||||||
...row.doc,
|
...tableDoc.doc,
|
||||||
type: "internal",
|
type: "internal",
|
||||||
sourceId: BudibaseInternalDB._id,
|
sourceId: BudibaseInternalDB._id,
|
||||||
}))
|
}))
|
||||||
|
@ -44,13 +44,18 @@ exports.fetch = async function (ctx) {
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
const external = externalTables.rows.flatMap(row => {
|
const external = externalTables.rows.flatMap(tableDoc => {
|
||||||
return Object.values(row.doc.entities || {}).map(entity => ({
|
let entities = tableDoc.doc.entities
|
||||||
...entity,
|
if (entities) {
|
||||||
type: "external",
|
return Object.values(entities).map(entity => ({
|
||||||
sourceId: row.doc._id,
|
...entity,
|
||||||
sql: isSQL(row.doc),
|
type: "external",
|
||||||
}))
|
sourceId: tableDoc.doc._id,
|
||||||
|
sql: isSQL(tableDoc.doc),
|
||||||
|
}))
|
||||||
|
} else {
|
||||||
|
return []
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
ctx.body = [...internal, ...external]
|
ctx.body = [...internal, ...external]
|
||||||
|
|
Loading…
Reference in New Issue