Skip to content

Commit

Permalink
fix customer relation serialization for waypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
roncodes committed Oct 2, 2024
1 parent 1a35da3 commit 9824e4f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions addon/serializers/waypoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@ export default class WaypointSerializer extends ApplicationSerializer.extend(Emb
type = belongsTo.attr(`${key}_type`);
}

// hotfix polymprohpic model types that do not exists as models like `customer-contact` `customer-vendor` should be `contact` or `vendor`
if (typeof type === 'string') {
if (type.startsWith('customer-')) {
type = type.replace('customer-', '');
}
if (type.startsWith('facilitator-')) {
type = type.replace('facilitator-', '');
}
}

if (!belongsTo) {
json[key + '_type'] = null;
} else {
Expand Down

0 comments on commit 9824e4f

Please sign in to comment.