Making sure certain fields aren't cleansed.

This commit is contained in:
mike12345567 2021-05-28 12:04:15 +01:00
parent 6c2f0f5917
commit 4b6fd4149b
1 changed files with 5 additions and 1 deletions

View File

@ -169,12 +169,16 @@ exports.inputProcessing = (user = {}, table, row) => {
let clonedRow = cloneDeep(row)
// need to copy the table so it can be differenced on way out
const copiedTable = cloneDeep(table)
const dontCleanseKeys = ["type", "_id", "_rev", "tableId"]
for (let [key, value] of Object.entries(clonedRow)) {
const field = table.schema[key]
// cleanse fields that aren't in the schema
if (!field) {
if (copiedTable.indexOf(key) === -1) {
delete clonedRow[key]
}
continue
}
clonedRow[key] = exports.coerce(value, field.type)
}
// handle auto columns - this returns an object like {table, row}