Files
threshold-ui/addons/api/addon/serializers/scope.js
T
55e1e68f30 [COMPLIANCE] Update Copyright and License Headers (#3099)
Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
Co-authored-by: Dharini <dharini@hashicorp.com>
2026-01-20 11:35:10 -05:00

36 lines
850 B
JavaScript

/**
* Copyright IBM Corp. 2021, 2025
* SPDX-License-Identifier: BUSL-1.1
*/
import ApplicationSerializer from './application';
export default class ScopeSerializer extends ApplicationSerializer {
// =methods
serialize(snapshot) {
let serialized = super.serialize(...arguments);
const policyId = snapshot?.adapterOptions?.policyId;
if (policyId) {
serialized = this.serializeWithStoragePolicy(snapshot, policyId);
}
return serialized;
}
/**
* Returns a payload containing only version and storage policy id,
* rather than existing instances on the model.
* @param {Snapshot} snapshot
* @param {[string]} hostSetIDs
* @return {object}
*/
serializeWithStoragePolicy(snapshot, policyId) {
return {
version: snapshot.attr('version'),
storage_policy_id: policyId,
};
}
}