mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-25 09:03:12 +03:00
28 lines
741 B
JavaScript
28 lines
741 B
JavaScript
|
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
|
||
|
});
|