2019-10-10 14:59:35 +03:00
|
|
|
/* eslint-disable camelcase */
|
2020-02-14 12:34:01 +03:00
|
|
|
import ApplicationSerializer from './application';
|
|
|
|
import {EmbeddedRecordsMixin} from '@ember-data/serializer/rest';
|
2019-10-10 14:59:35 +03:00
|
|
|
|
2022-02-02 21:35:18 +03:00
|
|
|
export default class MemberSerializer extends ApplicationSerializer.extend(EmbeddedRecordsMixin) {
|
|
|
|
attrs = {
|
2020-02-14 12:34:01 +03:00
|
|
|
createdAtUTC: {key: 'created_at'},
|
2020-12-10 14:38:38 +03:00
|
|
|
labels: {embedded: 'always'},
|
|
|
|
emailRecipients: {embedded: 'always'}
|
2022-02-10 13:41:36 +03:00
|
|
|
};
|
2019-11-28 14:30:21 +03:00
|
|
|
|
2019-10-10 14:59:35 +03:00
|
|
|
serialize(/*snapshot, options*/) {
|
2022-02-02 21:35:18 +03:00
|
|
|
let json = super.serialize(...arguments);
|
2019-10-10 14:59:35 +03:00
|
|
|
|
|
|
|
// Properties that exist on the model but we don't want sent in the payload
|
|
|
|
delete json.stripe;
|
2020-02-27 15:56:26 +03:00
|
|
|
delete json.geolocation;
|
2020-12-16 16:41:45 +03:00
|
|
|
delete json.email_recipients;
|
2021-08-10 15:13:36 +03:00
|
|
|
delete json.status;
|
2020-12-16 16:41:45 +03:00
|
|
|
|
2019-10-10 14:59:35 +03:00
|
|
|
// Normalize properties
|
|
|
|
json.name = json.name || '';
|
|
|
|
json.note = json.note || '';
|
2020-12-16 16:41:45 +03:00
|
|
|
|
2019-10-10 14:59:35 +03:00
|
|
|
return json;
|
|
|
|
}
|
2022-02-02 21:35:18 +03:00
|
|
|
}
|