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

25 lines
727 B
JavaScript
Raw Normal View History

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import ApplicationSerializer from './application';
2023-03-16 13:49:04 -04:00
import ChannelSerializer from './channel-recording';
export default ApplicationSerializer.extend({
2023-03-16 13:49:04 -04:00
modelName: 'connection-recording',
_hashForModel(model) {
const json = ApplicationSerializer.prototype._hashForModel.apply(
this,
arguments
);
2023-03-16 13:49:04 -04:00
const { channelRecordings } = this.schema;
if (model.channelRecordingIds) {
json.channel_recordings = model.channelRecordingIds.map((id) => {
const channel = channelRecordings.find(id);
return ChannelSerializer.prototype._hashForModel.apply(this, [channel]);
});
}
return json;
},
});