From e89db0497747071340383009e92e37f48ba2e796 Mon Sep 17 00:00:00 2001 From: Ross Date: Wed, 25 Mar 2026 17:44:59 -0700 Subject: [PATCH] Skip pollution notifications when feature is disabled --- src/server/services/notificationService.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/server/services/notificationService.ts b/src/server/services/notificationService.ts index cff14869..ebc5fcaa 100644 --- a/src/server/services/notificationService.ts +++ b/src/server/services/notificationService.ts @@ -17,6 +17,7 @@ import { type GeneratedNotification } from './notification-service.helper'; import { createFailureResponse, createSuccessResponse } from './service-response.helper'; +import { getAppConfigByKey } from './configService'; type NotificationType = keyof typeof NOTIFICATION_TYPES; type NotificationSource = keyof typeof NOTIFICATION_SOURCES; @@ -114,10 +115,18 @@ async function buildPuccNotifications(vehicleId: string): Promise { + let puccEnabled = true; + try { + const puccConfig = await getAppConfigByKey('featurePucc'); + if (puccConfig.success) puccEnabled = puccConfig.data?.value !== 'false'; + } catch { + // key not in DB yet — default to enabled + } + const [reminders, insurances, puccCertificates] = await Promise.all([ buildReminderNotifications(vehicleId), buildInsuranceNotifications(vehicleId), - buildPuccNotifications(vehicleId) + puccEnabled ? buildPuccNotifications(vehicleId) : Promise.resolve([]) ]); return sortNotificationsByDueDate([...reminders, ...insurances, ...puccCertificates]);