From b7bf6e80e6f4f2cab28e593315068d77cb18b97f Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Wed, 14 May 2025 17:51:22 +0200 Subject: [PATCH] fix: case insensitive filter for attendees on /bookings (#21302) --- .../routers/viewer/bookings/get.handler.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/packages/trpc/server/routers/viewer/bookings/get.handler.ts b/packages/trpc/server/routers/viewer/bookings/get.handler.ts index 58ab6f34a4..8b286dc063 100644 --- a/packages/trpc/server/routers/viewer/bookings/get.handler.ts +++ b/packages/trpc/server/routers/viewer/bookings/get.handler.ts @@ -937,27 +937,31 @@ function addAdvancedAttendeeWhereClause( switch (operator) { case "endsWith": - fullQuery = fullQuery.where(`Attendee.${key}`, "like", `%${operand}`); + fullQuery = fullQuery.where(`Attendee.${key}`, "ilike", `%${operand}`); break; case "startsWith": - fullQuery = fullQuery.where(`Attendee.${key}`, "like", `${operand}%`); + fullQuery = fullQuery.where(`Attendee.${key}`, "ilike", `${operand}%`); break; case "equals": - fullQuery = fullQuery.where(`Attendee.${key}`, "=", `${operand}`); + fullQuery = fullQuery.where((eb) => + eb(eb.fn("lower", [`Attendee.${key}`]), "=", `${operand.toLowerCase()}`) + ); break; case "notEquals": - fullQuery = fullQuery.where(`Attendee.${key}`, "!=", `${operand}`); + fullQuery = fullQuery.where((eb) => + eb(eb.fn("lower", [`Attendee.${key}`]), "!=", `${operand.toLowerCase()}`) + ); break; case "contains": - fullQuery = fullQuery.where(`Attendee.${key}`, "like", `%${operand}%`); + fullQuery = fullQuery.where(`Attendee.${key}`, "ilike", `%${operand}%`); break; case "notContains": - fullQuery = fullQuery.where(`Attendee.${key}`, "not like", `%${operand}%`); + fullQuery = fullQuery.where(`Attendee.${key}`, "not ilike", `%${operand}%`); break; case "isEmpty":