fix: adds transformer to map field names to field_id names
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
export const transformIdableFields = (obj, fields) => {
|
||||
const ret = { ...obj }
|
||||
|
||||
for (const key of fields) {
|
||||
if (key in obj && typeof key === "string") {
|
||||
ret[`${key}_id`] = ret[key]
|
||||
delete ret[key]
|
||||
}
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
Reference in New Issue
Block a user