1
0
Fork 0
mirror of synced 2024-10-05 12:34:50 +13:00

Merge pull request #11924 from Budibase/fix-relations-on-ds+

Fix link loading relationships on external datasources
This commit is contained in:
Adria Navarro 2023-09-28 16:45:38 +02:00 committed by GitHub
commit 8db86bcd8e
2 changed files with 10 additions and 5 deletions

View file

@ -72,10 +72,15 @@ export async function patch(ctx: UserCtx<PatchRowRequest, PatchRowResponse>) {
id: breakRowIdField(_id), id: breakRowIdField(_id),
row: dataToUpdate, row: dataToUpdate,
}) })
const row = await outputProcessing(table, response.row) const row = await sdk.rows.external.getRow(tableId, _id, {
relationships: true,
})
const enrichedRow = await outputProcessing(table, row, {
preserveLinks: true,
})
return { return {
...response, ...response,
row, row: enrichedRow,
table, table,
} }
} }
@ -116,7 +121,7 @@ export async function save(ctx: UserCtx) {
}) })
return { return {
...response, ...response,
row: await outputProcessing(table, row), row: await outputProcessing(table, row, { preserveLinks: true }),
} }
} else { } else {
return response return response

View file

@ -77,7 +77,7 @@ export async function search(options: SearchParams) {
} }
const table = await sdk.tables.getTable(tableId) const table = await sdk.tables.getTable(tableId)
rows = await outputProcessing(table, rows) rows = await outputProcessing(table, rows, { preserveLinks: true })
// need wrapper object for bookmarks etc when paginating // need wrapper object for bookmarks etc when paginating
return { rows, hasNextPage, bookmark: bookmark && bookmark + 1 } return { rows, hasNextPage, bookmark: bookmark && bookmark + 1 }
@ -174,7 +174,7 @@ export async function fetch(tableId: string) {
includeSqlRelationships: IncludeRelationship.INCLUDE, includeSqlRelationships: IncludeRelationship.INCLUDE,
}) })
const table = await sdk.tables.getTable(tableId) const table = await sdk.tables.getTable(tableId)
return await outputProcessing(table, response) return await outputProcessing(table, response, { preserveLinks: true })
} }
export async function fetchView(viewName: string) { export async function fetchView(viewName: string) {