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

27 lines
806 B
JavaScript
Raw Normal View History

/**
2026-01-28 17:09:06 -08:00
* Copyright IBM Corp. 2021, 2026
* SPDX-License-Identifier: BUSL-1.1
*/
import ApplicationSerializer from './application';
import { EmbeddedRecordsMixin } from '@ember-data/serializer/rest';
export default class ConnectionSerializer extends ApplicationSerializer.extend(
EmbeddedRecordsMixin,
) {
attrs = {
2023-03-16 13:49:04 -04:00
channel_recordings: { embedded: 'always' },
};
normalize(typeClass, hash, ...rest) {
const normalizedHash = structuredClone(hash);
const err = normalizedHash.errors;
delete normalizedHash.errors;
const normalized = super.normalize(typeClass, normalizedHash, ...rest);
// we should not override the ember models errors field,
// so we rename the errors field from the api
normalized.data.attributes.errors_number = err;
return normalized;
}
}