feat: add admin settings for reminder hour and minutes, and update expiry warning handling in UI and translations

This commit is contained in:
Daniel Volz
2025-12-25 13:06:43 +01:00
parent 1468c62d59
commit 80268fb1f1
7 changed files with 52 additions and 21 deletions
+2
View File
@@ -142,6 +142,8 @@ export async function settingsRoutes(app: FastifyInstance) {
nextScheduledCheck: reminderState.nextScheduledCheck,
lastNotificationType: reminderState.lastNotificationType,
lastNotificationChannel: reminderState.lastNotificationChannel,
// Admin settings (from .env, read-only)
expiryWarningDays: parseInt(process.env.EXPIRY_WARNING_DAYS ?? "30", 10),
});
});
@@ -13,7 +13,7 @@ type IntakeReminderState = {
sentReminders: string[]; // Array of "medName:timestamp" to track sent reminders
};
const REMINDER_MINUTES_BEFORE = 15;
const REMINDER_MINUTES_BEFORE = parseInt(process.env.REMINDER_MINUTES_BEFORE ?? "15", 10);
const CHECK_INTERVAL_MS = 60 * 1000; // Check every 1 minute
// Get current timezone from TZ env variable or default to UTC
+1 -1
View File
@@ -36,7 +36,7 @@ type ReminderState = {
lastNotificationChannel: "email" | "push" | "both" | null; // Channel used for last notification
};
const REMINDER_HOUR = 6; // 6:00 AM local time
const REMINDER_HOUR = parseInt(process.env.REMINDER_HOUR ?? "6", 10); // Default 6:00 AM local time
// Get current timezone from TZ env variable or default to UTC
function getTimezone(): string {