diff --git a/lib/customers.js b/lib/customers.js index 89ea723f..4bdcd9e4 100644 --- a/lib/customers.js +++ b/lib/customers.js @@ -670,7 +670,7 @@ function getCustomersList (phone = null, name = null, address = null, id = null) .then(customers => Promise.all(_.map(customer => { return populateOverrideUsernames(customer) .then(camelize) - .then(it => ({ ...it, notes: it.notes.map(camelize) })) + .then(it => ({ ...it, notes: (it.notes ?? []).map(camelize) })) }, customers))) } @@ -723,7 +723,7 @@ function getCustomerById (id) { }) .then(populateOverrideUsernames) .then(camelize) - .then(it => ({ ...it, notes: it.notes.map(camelize) })) + .then(it => ({ ...it, notes: (it.notes ?? []).map(camelize) })) } /** diff --git a/migrations/1627868356883-customer-custom-notes.js b/migrations/1627868356883-customer-custom-notes.js index 4e8497ec..1bb16d42 100644 --- a/migrations/1627868356883-customer-custom-notes.js +++ b/migrations/1627868356883-customer-custom-notes.js @@ -8,7 +8,7 @@ exports.up = function (next) { created TIMESTAMPTZ NOT NULL DEFAULT now(), last_edited_at TIMESTAMPTZ, last_edited_by UUID REFERENCES users(id), - title TEXT NOT NULL DEFAULT '' + title TEXT NOT NULL DEFAULT '', content TEXT NOT NULL DEFAULT '' )` ] diff --git a/new-lamassu-admin/src/pages/Customers/CustomerData.js b/new-lamassu-admin/src/pages/Customers/CustomerData.js index e4d08202..847bf747 100644 --- a/new-lamassu-admin/src/pages/Customers/CustomerData.js +++ b/new-lamassu-admin/src/pages/Customers/CustomerData.js @@ -426,7 +426,7 @@ const CustomerData = ({ Custom data entry )} - {customRequirements && ( + {!R.isEmpty(customRequirements) && (