From 169c499d617bcb9273fe5f15ff633412f9f5a84b Mon Sep 17 00:00:00 2001 From: Ahmed Bouhuolia Date: Sun, 29 Nov 2020 13:47:28 +0200 Subject: [PATCH] fix: closing balance in customers list API. --- server/src/services/Contacts/CustomersService.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/server/src/services/Contacts/CustomersService.ts b/server/src/services/Contacts/CustomersService.ts index 2f801d0e2..509512dfe 100644 --- a/server/src/services/Contacts/CustomersService.ts +++ b/server/src/services/Contacts/CustomersService.ts @@ -69,7 +69,7 @@ export default class CustomersService { private transformContactToCustomer(contactModel: IContact) { return { - ...omit(contactModel, ['contactService', 'contactType']), + ...omit(contactModel.toJSON(), ['contactService', 'contactType']), customerType: contactModel.contactType, }; } @@ -174,7 +174,11 @@ export default class CustomersService { public async getCustomersList( tenantId: number, customersFilter: ICustomersFilter - ): Promise<{ customers: ICustomer[], pagination: IPaginationMeta, filterMeta: IFilterMeta }> { + ): Promise<{ + customers: ICustomer[], + pagination: IPaginationMeta, + filterMeta: IFilterMeta, + }> { const { Contact } = this.tenancy.models(tenantId); const dynamicList = await this.dynamicListService.dynamicList(tenantId, Contact, customersFilter);