2020-09-11 11:04:15 -04:00
|
|
|
import JSONSerializer from '@ember-data/serializer/json';
|
|
|
|
|
|
2021-09-20 15:10:04 -04:00
|
|
|
export default class FragmentHostSourceSerializer extends JSONSerializer {
|
2020-09-11 11:04:15 -04:00
|
|
|
// =methods
|
|
|
|
|
|
|
|
|
|
/**
|
2021-09-21 09:37:47 -04:00
|
|
|
* Renames `id` to `host_source_id` because fragments may not have IDs.
|
2020-09-11 11:04:15 -04:00
|
|
|
* Otherwise normalizes as normal.
|
|
|
|
|
* @param {ModelClass} typeClass
|
|
|
|
|
* @param {object} resourceHash
|
|
|
|
|
* @return {object}
|
|
|
|
|
*/
|
2021-09-21 09:37:47 -04:00
|
|
|
normalize(typeClass, { id: host_source_id, ...obj }) {
|
|
|
|
|
return super.normalize(typeClass, { host_source_id, ...obj });
|
2020-09-11 11:04:15 -04:00
|
|
|
}
|
|
|
|
|
}
|