Files
threshold-ui/ui/core/mirage/serializers/group.js
T

19 lines
521 B
JavaScript
Raw Normal View History

2020-06-24 17:07:32 -04:00
import ApplicationSerializer from './application';
2020-09-01 12:03:36 -04:00
import { underscore } from '@ember/string';
2020-06-24 17:07:32 -04:00
export default ApplicationSerializer.extend({
2020-09-01 12:03:36 -04:00
modelName: 'group',
keyForRelationshipIds(relationshipName) {
return `${this._container.inflector.singularize(
underscore(relationshipName)
)}_ids`;
},
_hashForModel(model) {
const json = ApplicationSerializer.prototype._hashForModel.apply(this, arguments);
2020-09-12 11:47:27 -04:00
if (model.memberIds.length) json.member_ids = model.memberIds;
2020-09-01 12:03:36 -04:00
return json;
}
2020-06-24 17:07:32 -04:00
});