import { Client } from './client.model'; import { RequiredJsonPropertyError } from './../error/required-json-property.error'; export class ClientSerializer { public serialize(item: Client): {[key: string]: any} { if (!item.organization || !item.organization.id) { throw new RequiredJsonPropertyError(item, 'organization.id'); } const json: {[key: string]: any} = {}; if (item.id) { json['id'] = item.id; } json['organization_id'] = item.organization.id; json['name'] = item.name; json['email'] = item.email; json['phone_number'] = item.phone; return json; } }