feat: 🎸 Finish fragment serializer and tests

Finish fragment serializer and refactor the tests of the model to
accomadate the change.
This commit is contained in:
Carlos Alcaide Corvo committed 2021-11-05 08:55:37 -07:00
1 parent 499432522a
commit 2620607cc3
6 files changed
+29 -6

No files matched your search

@@ -14,7 +14,7 @@ export default class FragmentManagedGroupsAttributesSerializer extends JSONSeria
serializeAttribute(snapshot, json, key, attribute) {
const { type, options } = attribute;
let value = super.serializeAttribute(...arguments);
// COnvert empty strin to null.
// Convert empty string to null.
if (type === 'string' && json[key] === '') json[key] = null;
// Do not serialize read-only attributes.
if (options.readOnly) delete json[key];