import CustomerAdapterInterface from './CustomerAdapterInterface'; import Customer from '../entity/Customer'; export default class CustomerAdapter implements CustomerAdapterInterface { adapt(json: any, instance: Customer): Customer { instance.id = json.id; instance.name = json.name; instance.surname = json.surname; return instance; } prepare(instance: Customer): any { let object = { id: instance.id, name: instance.name, surname: instance.surname, }; return object; } transformToEntity(json: any): Customer { return this.adapt(json, new Customer()); } transformToPayload(instance: Customer): any { return this.prepare(instance); } }