Skip to content

Scheduling infrastructure for absolutely everyone.

fix: case insensitive filter for attendees on /bookings (#21302)

Eunjae Leeb7bf6e80e6f4
diff --git a/packages/trpc/server/routers/viewer/bookings/get.handler.ts b/packages/trpc/server/routers/viewer/bookings/get.handler.ts
index 58ab6f34a45..8b286dc0635 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<string>("lower", [`Attendee.${key}`]), "=", `${operand.toLowerCase()}`)
+ );
break;
case "notEquals":
- fullQuery = fullQuery.where(`Attendee.${key}`, "!=", `${operand}`);
+ fullQuery = fullQuery.where((eb) =>
+ eb(eb.fn<string>("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":