From fdff4feeae7e5ede3c79f8ea5bcfb13193bec368 Mon Sep 17 00:00:00 2001 From: Rafael Taranto Date: Tue, 24 Jun 2025 12:24:52 +0100 Subject: [PATCH] fix: trim customer names --- packages/typesafe-db/src/customers.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/typesafe-db/src/customers.ts b/packages/typesafe-db/src/customers.ts index 38144cad..3168ba1d 100644 --- a/packages/typesafe-db/src/customers.ts +++ b/packages/typesafe-db/src/customers.ts @@ -190,11 +190,11 @@ function searchCustomers(searchTerm: string, limit: number = 20): Promise { 'cst.id', 'cst.phone', 'cst.email', - sql`CONCAT( + sql`TRIM(CONCAT( COALESCE(${selectNewestIdCardData(eb)}->>'firstName', ''), ' ', COALESCE(${selectNewestIdCardData(eb)}->>'lastName', '') - )`.as('customerName'), + ))`.as('customerName'), ]) .where('cst.id', '!=', ANON_ID) .as('customers_with_names'),