Ghost/ghost/admin/mirage/serializers/subscription.js

28 lines
741 B
JavaScript
Raw Normal View History

import BaseSerializer from './application';
import {underscore} from '@ember/string';
export default BaseSerializer.extend({
embed: true,
include(/*request*/) {
let includes = [];
includes.push('product');
return includes;
},
keyForEmbeddedRelationship(relationshipName) {
if (relationshipName === 'product') {
return 'tier';
}
return underscore(relationshipName);
}
// NOTE: serialize() is not called for embedded records, serialization happens
// on the primary resource, in this case `member`
// TODO: extract subscription serialization and call it here too if we start
// to treat subscriptions as their own non-embedded resource
});