2022-03-18 19:15:42 +03:00
|
|
|
import BaseSerializer from './application';
|
|
|
|
import {underscore} from '@ember/string';
|
|
|
|
|
|
|
|
export default BaseSerializer.extend({
|
|
|
|
embed: true,
|
|
|
|
|
|
|
|
include(/*request*/) {
|
|
|
|
let includes = [];
|
|
|
|
|
2022-05-11 20:11:54 +03:00
|
|
|
includes.push('tier');
|
2022-03-18 19:15:42 +03:00
|
|
|
|
|
|
|
return includes;
|
|
|
|
},
|
|
|
|
|
|
|
|
keyForEmbeddedRelationship(relationshipName) {
|
2022-05-11 20:11:54 +03:00
|
|
|
if (relationshipName === 'tier') {
|
2022-03-18 19:15:42 +03:00
|
|
|
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
|
|
|
|
});
|