2021-12-17 10:52:12 +01:00
|
|
|
import DataFetch from "./DataFetch.js"
|
2022-01-18 10:39:19 +01:00
|
|
|
import { fetchViewData } from "../api"
|
2021-12-17 09:22:04 +01:00
|
|
|
|
2021-12-17 10:52:12 +01:00
|
|
|
export default class ViewFetch extends DataFetch {
|
2021-12-17 19:48:44 +01:00
|
|
|
static getSchema(datasource, definition) {
|
|
|
|
return definition?.views?.[datasource.name]?.schema
|
2021-12-17 09:22:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
async getData() {
|
|
|
|
const { datasource } = this.options
|
|
|
|
const res = await fetchViewData(datasource)
|
|
|
|
return {
|
|
|
|
rows: res || [],
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|