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

26 lines
619 B
JavaScript
Raw Normal View History

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
2020-06-23 14:56:13 -04:00
import ApplicationSerializer from './application';
2020-09-30 10:45:39 -04:00
import { underscore } from '@ember/string';
2020-06-23 14:56:13 -04:00
export default ApplicationSerializer.extend({
2020-09-30 10:45:39 -04:00
modelName: 'user',
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-09-30 10:45:39 -04:00
if (model.accountIds.length) json.account_ids = model.accountIds;
return json;
2021-03-04 15:47:38 -05:00
},
2020-06-23 14:56:13 -04:00
});