Simplify
This commit is contained in:
parent
f053438a64
commit
5d63fe251f
|
@ -360,12 +360,11 @@ export default abstract class DataFetch<
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the schema definition for a datasource.
|
* Gets the schema definition for a datasource.
|
||||||
* @param datasource the datasource
|
|
||||||
* @param definition the datasource definition
|
* @param definition the datasource definition
|
||||||
* @return {object} the schema
|
* @return {object} the schema
|
||||||
*/
|
*/
|
||||||
getSchema(_datasource: TDatasource | null, definition: TDefinition | null) {
|
getSchema(definition: TDefinition | null): Record<string, any> | undefined {
|
||||||
return definition?.schema
|
return definition?.schema ?? undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -19,7 +19,8 @@ export default class ViewFetch extends DataFetch<ViewV1, Table> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getSchema(datasource: ViewV1, definition: Table) {
|
getSchema(definition: Table) {
|
||||||
|
const { datasource } = this.options
|
||||||
return definition?.views?.[datasource.name]?.schema
|
return definition?.views?.[datasource.name]?.schema
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,5 +76,5 @@ export const getDatasourceSchema = ({
|
||||||
definition?: { schema?: TableSchema }
|
definition?: { schema?: TableSchema }
|
||||||
}) => {
|
}) => {
|
||||||
const instance = createEmptyFetchInstance({ API, datasource })
|
const instance = createEmptyFetchInstance({ API, datasource })
|
||||||
return instance?.getSchema(datasource, definition)
|
return instance?.getSchema(definition)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue