Skip to content

Commit

Permalink
Merge branch 'master' into grid-block-template
Browse files Browse the repository at this point in the history
  • Loading branch information
mike12345567 authored Oct 19, 2023
2 parents 9971b39 + 1df9414 commit 33ff807
Show file tree
Hide file tree
Showing 17 changed files with 948 additions and 767 deletions.
7 changes: 1 addition & 6 deletions packages/server/src/api/controllers/datasource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
getQueryParams,
getTableParams,
} from "../../db/utils"
import { destroy as tableDestroy } from "./table/internal"
import { getIntegration } from "../../integrations"
import { invalidateDynamicVariables } from "../../threads/utils"
import { context, db as dbCore, events } from "@budibase/backend-core"
Expand Down Expand Up @@ -325,11 +324,7 @@ async function destroyInternalTablesBySourceId(datasourceId: string) {

// Destroy the tables.
for (const table of datasourceTableDocs) {
await tableDestroy({
params: {
tableId: table._id,
},
})
await sdk.tables.internal.destroy(table)
}
}

Expand Down
36 changes: 36 additions & 0 deletions packages/server/src/api/controllers/table/ExternalRequest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import {
Datasource,
Operation,
QueryJson,
RenameColumn,
Table,
} from "@budibase/types"
import { makeExternalQuery } from "../../../integrations/base/query"

export async function makeTableRequest(
datasource: Datasource,
operation: Operation,
table: Table,
tables: Record<string, Table>,
oldTable?: Table,
renamed?: RenameColumn
) {
const json: QueryJson = {
endpoint: {
datasourceId: datasource._id!,
entityId: table._id!,
operation,
},
meta: {
tables,
},
table,
}
if (oldTable) {
json.meta!.table = oldTable
}
if (renamed) {
json.meta!.renamed = renamed
}
return makeExternalQuery(datasource, json)
}
Loading

0 comments on commit 33ff807

Please sign in to comment.