Files
threshold-ui/addons/api/mirage/serializers/connection.js
T
Zhihe Li ce83346461 Icu 8073 mirage recording connection channel (#109)
* feat: 🎸 Add mirage data for recordings, connections, channels

✅ Closes: ICU-8073
2023-03-10 14:20:58 -05:00

26 lines
661 B
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import ApplicationSerializer from './application';
import ChannelSerializer from './channel';
export default ApplicationSerializer.extend({
modelName: 'connection',
_hashForModel(model) {
const json = ApplicationSerializer.prototype._hashForModel.apply(
this,
arguments
);
const { channels } = this.schema;
if (model.channelIds) {
json.channels = model.channelIds.map((id) => {
const channel = channels.find(id);
return ChannelSerializer.prototype._hashForModel.apply(this, [channel]);
});
}
return json;
},
});