Files
Fleetbase-Mirror-Repo/console/app/serializers/comment.js
Ronald A. Richardson b6bad3212d ready for release
2024-02-07 15:16:36 +08:00

39 lines
965 B
JavaScript

import ApplicationSerializer from '@fleetbase/ember-core/serializers/application';
import { EmbeddedRecordsMixin } from '@ember-data/serializer/rest';
export default class CommentSerializer extends ApplicationSerializer.extend(EmbeddedRecordsMixin) {
/**
* Embedded relationship attributes
*
* @var {Object}
*/
get attrs() {
return {
author: { embedded: 'always' },
parent: { embedded: 'always' },
replies: { embedded: 'always' },
};
}
serializeAttribute(snapshot, json, key) {
if (key === 'editable') {
return;
}
super.serializeAttribute(...arguments);
}
serializeHasMany(snapshot, json, relationship) {
let key = relationship.key;
if (key === 'replies') {
return;
} else {
super.serializeHasMany(...arguments);
}
}
serializeBelongsTo() {
return;
}
}