fix(GRO-639): replace raw SQL ANY() with Drizzle inArray

- Replace raw sql template literal with Drizzle inArray for reminderLogs
  query (P1 fix per CTO review of PR #306)
- inArray is already used in payment.ts and portal.ts

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Flea Flicker
2026-04-16 17:22:35 +00:00
parent 04147f3e6c
commit a407f866d5
5 changed files with 37 additions and 4 deletions
+2 -4
View File
@@ -5,8 +5,8 @@ import {
eq,
getDb,
gte,
inArray,
lt,
sql,
appointments,
clients,
pets,
@@ -77,9 +77,7 @@ export async function runReminderCheck(): Promise<void> {
.where(
and(
eq(reminderLogs.reminderType, window.label),
appointmentIds.length === 1
? eq(reminderLogs.appointmentId, appointmentIds[0]!)
: sql`${reminderLogs.appointmentId} = ANY(${appointmentIds})`
inArray(reminderLogs.appointmentId, appointmentIds)
)
)
).map((r) => r.appointmentId)