fix: trim customer names

This commit is contained in:
Rafael Taranto 2025-06-24 12:24:52 +01:00
parent 686dc3e992
commit fdff4feeae

View file

@ -190,11 +190,11 @@ function searchCustomers(searchTerm: string, limit: number = 20): Promise<any> {
'cst.id', 'cst.id',
'cst.phone', 'cst.phone',
'cst.email', 'cst.email',
sql`CONCAT( sql`TRIM(CONCAT(
COALESCE(${selectNewestIdCardData(eb)}->>'firstName', ''), COALESCE(${selectNewestIdCardData(eb)}->>'firstName', ''),
' ', ' ',
COALESCE(${selectNewestIdCardData(eb)}->>'lastName', '') COALESCE(${selectNewestIdCardData(eb)}->>'lastName', '')
)`.as('customerName'), ))`.as('customerName'),
]) ])
.where('cst.id', '!=', ANON_ID) .where('cst.id', '!=', ANON_ID)
.as('customers_with_names'), .as('customers_with_names'),