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'},
|
2022-02-22 20:13:32 +03:00
|
|
|
lastSeenAtUTC: {key: 'last_seen_at'},
|
2020-12-10 14:38:38 +03:00
|
|
|
labels: {embedded: 'always'},
|
2022-04-14 17:40:04 +03:00
|
|
|
newsletters: {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;
|
2021-08-10 15:13:36 +03:00
|
|
|
delete json.status;
|
2022-02-24 20:46:57 +03:00
|
|
|
delete json.last_seen_at;
|
2022-08-17 15:30:49 +03:00
|
|
|
delete json.comped;
|
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
|
|
|
}
|