Fix link loading relationships on external ds+

This commit is contained in:
Adria Navarro 2023-09-28 15:54:53 +02:00
parent 7fedb8491c
commit 5b5c0b31ff
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),
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 {
...response,
row,
row: enrichedRow,
table,
}
}
@ -116,7 +121,7 @@ export async function save(ctx: UserCtx) {
})
return {
...response,
row: await outputProcessing(table, row),
row: await outputProcessing(table, row, { preserveLinks: true }),
}
} else {
return response

View File

@ -77,7 +77,7 @@ export async function search(options: SearchParams) {
}
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
return { rows, hasNextPage, bookmark: bookmark && bookmark + 1 }
@ -174,7 +174,7 @@ export async function fetch(tableId: string) {
includeSqlRelationships: IncludeRelationship.INCLUDE,
})
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) {