Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { ActiveModelSerializer } from 'active-model-adapter';
export default ActiveModelSerializer.extend({
isNewSerializerAPI: true,
serializeBelongsTo: function(snapshot, json, relationship) {
if (!['primaryContact'].contains(relationship.key)) {
this._super(snapshot, json, relationship);
}
}
});
import { ActiveModelSerializer } from 'active-model-adapter';
export default ActiveModelSerializer.extend({
isNewSerializerAPI: true,
serializeHasMany(record, json, relationship) {
let { key } = relationship;
if (key === 'categories') {
json[key] = (record.hasMany(key) || []).mapBy('id');
} else {
this._super(...arguments);
}
}
});
import { ActiveModelSerializer } from 'active-model-adapter';
export default ActiveModelSerializer.extend({
isNewSerializerAPI: true,
serializeAttribute: function(record, json, key, attribute) {
if (!['createdAt', 'updatedAt'].contains(attribute.name)) {
this._super(record, json, key, attribute);
}
}
});
import { ActiveModelSerializer } from 'active-model-adapter';
export default ActiveModelSerializer.extend({
singularModelName: 'issue',
normalizeArrayResponse(store, primaryModelClass, payload) {
payload[this.singularModelName] = payload.items;
delete payload.items;
delete payload.total_count;
delete payload.incomplete_results;
return this._super(...arguments)
},
});