PR comments.
This commit is contained in:
parent
7b603a35df
commit
590844c8a9
|
@ -21,7 +21,7 @@ import {
|
|||
CreateDatasourceRequest,
|
||||
VerifyDatasourceRequest,
|
||||
VerifyDatasourceResponse,
|
||||
FetchTablesDatasourceResponse,
|
||||
FetchDatasourceInfoResponse,
|
||||
IntegrationBase,
|
||||
DatasourcePlus,
|
||||
} from "@budibase/types"
|
||||
|
@ -154,8 +154,8 @@ export async function verify(
|
|||
}
|
||||
}
|
||||
|
||||
export async function fetchTables(
|
||||
ctx: UserCtx<void, FetchTablesDatasourceResponse>
|
||||
export async function information(
|
||||
ctx: UserCtx<void, FetchDatasourceInfoResponse>
|
||||
) {
|
||||
const datasourceId = ctx.params.datasourceId
|
||||
const datasource = await sdk.datasources.get(datasourceId, { enriched: true })
|
||||
|
|
|
@ -21,9 +21,9 @@ router
|
|||
datasourceController.verify
|
||||
)
|
||||
.get(
|
||||
"/api/datasources/:datasourceId/tables",
|
||||
"/api/datasources/:datasourceId/info",
|
||||
authorized(permissions.BUILDER),
|
||||
datasourceController.fetchTables
|
||||
datasourceController.information
|
||||
)
|
||||
.get(
|
||||
"/api/datasources/:datasourceId",
|
||||
|
|
|
@ -1055,12 +1055,12 @@ describe("postgres integrations", () => {
|
|||
})
|
||||
})
|
||||
|
||||
describe("GET /api/datasources/:datasourceId/tables", () => {
|
||||
it("should fetch tables within postgres datasource", async () => {
|
||||
describe("GET /api/datasources/:datasourceId/info", () => {
|
||||
it("should fetch information about postgres datasource", async () => {
|
||||
const primaryName = primaryPostgresTable.name
|
||||
const response = await makeRequest(
|
||||
"get",
|
||||
`/api/datasources/${postgresDatasource._id}/tables`
|
||||
`/api/datasources/${postgresDatasource._id}/info`
|
||||
)
|
||||
expect(response.status).toBe(200)
|
||||
expect(response.body.tableNames).toBeDefined()
|
||||
|
|
|
@ -330,11 +330,7 @@ class OracleIntegration extends Sql implements DatasourcePlus {
|
|||
const columnsResponse = await this.internalQuery<OracleColumnsResponse>({
|
||||
sql: this.COLUMNS_SQL,
|
||||
})
|
||||
if (!columnsResponse.rows) {
|
||||
return []
|
||||
} else {
|
||||
return columnsResponse.rows.map(row => row.TABLE_NAME)
|
||||
}
|
||||
return (columnsResponse.rows || []).map(row => row.TABLE_NAME)
|
||||
}
|
||||
|
||||
async testConnection() {
|
||||
|
|
|
@ -23,7 +23,7 @@ export interface VerifyDatasourceResponse {
|
|||
error?: string
|
||||
}
|
||||
|
||||
export interface FetchTablesDatasourceResponse {
|
||||
export interface FetchDatasourceInfoResponse {
|
||||
tableNames: string[]
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue