From b9d91385b43de7ede508884f7cf78b5cf785f853 Mon Sep 17 00:00:00 2001 From: Luca <102960244+Luca-Timo@users.noreply.github.com> Date: Mon, 29 Jun 2026 17:19:54 +0200 Subject: [PATCH] fix(reminders): wrap is_active/is_archived wheres in formatBoolean MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit eventReminderService used bare boolean literals in its knex .where() calls (events.is_active/is_archived/event_reminder_disabled and the assigned- customer c.is_active), instead of the codebase's formatBoolean() convention (utils/dbCompat). On SQLite, booleans are stored as 0/1, so a bare `true` relies on knex's coercion rather than the explicit helper every other service uses — the maintainer flagged this twice (#674, #679). Wrap all four. --- backend/src/services/eventReminderService.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/backend/src/services/eventReminderService.js b/backend/src/services/eventReminderService.js index 6d46d769..ed6c7891 100644 --- a/backend/src/services/eventReminderService.js +++ b/backend/src/services/eventReminderService.js @@ -55,6 +55,7 @@ const { db } = require('../database/db'); const emailProcessor = require('./emailProcessor'); +const { formatBoolean } = require('../utils/dbCompat'); const { getAppSetting } = require('../utils/appSettings'); const { hasColumnCached } = require('../utils/schemaCache'); const logger = require('../utils/logger'); @@ -176,9 +177,9 @@ async function runEventReminderPass() { const now = new Date(); const rows = await db('events') .whereNotNull('events.event_date') - .where('events.is_active', true) - .where('events.is_archived', false) - .where('events.event_reminder_disabled', false) + .where('events.is_active', formatBoolean(true)) + .where('events.is_archived', formatBoolean(false)) + .where('events.event_reminder_disabled', formatBoolean(false)) .whereNull('events.event_reminder_sent_at') .where('events.event_date', '>=', now.toISOString().slice(0, 10)) .select('events.*'); @@ -328,7 +329,7 @@ async function resolveReminderRecipients(eventRow) { const assigned = await db('event_customer_assignments as a') .join('customer_accounts as c', 'c.id', 'a.customer_account_id') .where('a.event_id', eventRow.id) - .where('c.is_active', true) + .where('c.is_active', formatBoolean(true)) .whereNotNull('c.email') .select('c.email'); // De-dup emails defensively (a customer assigned twice, etc.).