Fix wrong schema while fetching from datasource
This commit is contained in:
parent
61967b6b4b
commit
874df3f54d
|
@ -71,19 +71,20 @@ export async function fetch(ctx: UserCtx<void, FetchTablesResponse>) {
|
||||||
|
|
||||||
const datasources = await sdk.datasources.getExternalDatasources()
|
const datasources = await sdk.datasources.getExternalDatasources()
|
||||||
|
|
||||||
const external = datasources.flatMap(datasource => {
|
const external: Table[] = []
|
||||||
|
for (const datasource of datasources) {
|
||||||
let entities = datasource.entities
|
let entities = datasource.entities
|
||||||
if (entities) {
|
if (entities) {
|
||||||
return Object.values(entities).map<Table>((entity: Table) => ({
|
for (const entity of Object.values(entities)) {
|
||||||
...entity,
|
external.push({
|
||||||
sourceType: TableSourceType.EXTERNAL,
|
...(await processTable(entity)),
|
||||||
sourceId: datasource._id!,
|
sourceType: TableSourceType.EXTERNAL,
|
||||||
sql: isSQL(datasource),
|
sourceId: datasource._id!,
|
||||||
}))
|
sql: isSQL(datasource),
|
||||||
} else {
|
})
|
||||||
return []
|
}
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
|
||||||
const result: FetchTablesResponse = []
|
const result: FetchTablesResponse = []
|
||||||
for (const table of [...internal, ...external]) {
|
for (const table of [...internal, ...external]) {
|
||||||
|
|
Loading…
Reference in New Issue