Skip to content

Commit

Permalink
Ignore property if model association is not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
anthioikonomou committed Oct 24, 2024
1 parent 632814b commit ff954d8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions select-object-query.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,12 @@ class SelectObjectQuery {
// otherwise, if this property is an association
if (isObjectDeep(value)) {
// assign associated key value (event.g. primary key value)
Object.assign(prev, {
[name]: value[mapping.parentField]
});
// ignore property if model doesn't have an association with it
if (mapping) {
Object.assign(prev, {
[name]: value[mapping.parentField]
});
}
} else {
Object.assign(prev, {
[name]: value
Expand Down

0 comments on commit ff954d8

Please sign in to comment.