feat: add stock calculation mode to user settings with automatic and manual options

This commit is contained in:
Daniel Volz
2025-12-28 15:03:24 +01:00
parent 78ee668c8b
commit 0e52a03f7a
8 changed files with 165 additions and 10 deletions
@@ -0,0 +1,4 @@
-- Add stock calculation mode setting
-- "automatic" = stock decreases based on schedule from start date
-- "manual" = stock only decreases when doses are marked as taken
ALTER TABLE user_settings ADD COLUMN stock_calculation_mode TEXT NOT NULL DEFAULT 'automatic';
+2 -1
View File
@@ -13,6 +13,7 @@
{ "idx": 10, "version": 1, "when": 1735600000, "tag": "0010_add_user_settings", "breakpoint": false },
{ "idx": 11, "version": 1, "when": 1735700000, "tag": "0011_add_dose_tracking", "breakpoint": false },
{ "idx": 12, "version": 1, "when": 1735800000, "tag": "0012_add_user_avatar", "breakpoint": false },
{ "idx": 13, "version": 1, "when": 1735900000, "tag": "0013_add_oidc_subject", "breakpoint": false }
{ "idx": 13, "version": 1, "when": 1735900000, "tag": "0013_add_oidc_subject", "breakpoint": false },
{ "idx": 14, "version": 1, "when": 1735400000, "tag": "0014_add_stock_calculation_mode", "breakpoint": false }
]
}
+2
View File
@@ -69,6 +69,8 @@ export const userSettings = sqliteTable("user_settings", {
highStockDays: integer("high_stock_days").notNull().default(180),
// UI preferences
language: text("language", { length: 10 }).notNull().default("en"),
// Stock calculation mode: "automatic" (schedule-based) or "manual" (only marked doses)
stockCalculationMode: text("stock_calculation_mode", { length: 20 }).notNull().default("automatic"),
// Last notification tracking
lastAutoEmailSent: text("last_auto_email_sent"),
lastNotificationType: text("last_notification_type"),