Files
threshold-ui/addons/api/mirage/serializers/host-set.js
T

24 lines
599 B
JavaScript
Raw Normal View History

2020-08-19 18:38:18 -04:00
import ApplicationSerializer from './application';
import { underscore } from '@ember/string';
export default ApplicationSerializer.extend({
modelName: 'host-set',
keyForRelationshipIds(relationshipName) {
return `${this._container.inflector.singularize(
underscore(relationshipName)
)}_ids`;
},
_hashForModel(model) {
2021-03-04 15:47:38 -05:00
const json = ApplicationSerializer.prototype._hashForModel.apply(
this,
arguments
);
2020-08-27 16:38:49 -04:00
json.host_catalog_id = model.hostCatalogId;
2020-09-12 11:20:38 -04:00
if (model.hostIds?.length) {
json.host_ids = model.hostIds;
}
2020-08-19 18:38:18 -04:00
return json;
2021-03-04 15:47:38 -05:00
},
2020-08-19 18:38:18 -04:00
});