refactor: 💡 application serializeAttribute (#1772)

* refactor: 💡 application serializeAttribute
This commit is contained in:
Dharini Jeeva authored and GitHub committed 2023-07-14 09:46:47 -07:00
1 parent 66fc50bf9e
commit 7ee52ea06f
4 files changed
+67 -32

No files matched your search

@@ -24,21 +24,6 @@ export default class AuthMethodSerializer extends ApplicationSerializer {
}
}
serializeAttribute(snapshot, json, key, attribute) {
const { type } = snapshot.record;
super.serializeAttribute(...arguments);
const { options } = attribute;
// If an attribute has a `for` option, it must match the
// record's `type`, else the attribute is excluded
// from serialization.
if (options?.for && !options.for.includes(type)) {
if (options.isNestedAttribute) {
delete json?.attributes?.[key];
}
}
}
/**
* Password serialization omits `attributes`.
* @return {object}