import { LeadComment } from './lead-comment.model'; import { RequiredJsonPropertyError } from './../error/required-json-property.error'; export class LeadCommentSerializer { public serialize(item: LeadComment): {[key: string]: any} { if (!item.author || !item.author.userId) { throw new RequiredJsonPropertyError(item, 'author.id'); } const json: {[key: string]: any} = {}; json['id'] = item.id; json['content'] = item.content; json['author_id'] = item.author.userId; json['created_at'] = item.createdAt; return json; } }