Getting create/update response consistent with internal API for external.

This commit is contained in:
mike12345567 2023-09-29 13:40:40 +01:00
parent 3dc7192113
commit 5a3ecc3095
2 changed files with 10 additions and 7 deletions

View File

@ -1787,19 +1787,14 @@ describe.each([
user: null,
users: null,
})
const toCompare: any = {
expect(updatedRow).toEqual({
name: rowData.name,
description: rowData.description,
tableId,
_id: row._id,
_rev: expect.any(String),
type: "row",
}
if (!isInternal) {
toCompare.user = null
toCompare.users = null
}
expect(updatedRow).toEqual(toCompare)
})
})
it("fetch all will populate the relationships", async () => {

View File

@ -250,6 +250,14 @@ export async function outputProcessing<T extends Row[] | Row>(
enriched
)) as Row[]
}
// remove null properties to match internal API
for (let row of enriched) {
for (let key of Object.keys(row)) {
if (row[key] === null) {
delete row[key]
}
}
}
return (wasArray ? enriched : enriched[0]) as T
}