Add first day of the week feature to user settings and calendar functionality

This commit is contained in:
Greg Burri 2025-04-19 12:01:46 +02:00
parent 39f5b968b4
commit fdbf2e4f27
15 changed files with 191 additions and 42 deletions

View file

@ -17,6 +17,8 @@ CREATE TABLE [User] (
[default_servings] INTEGER DEFAULT 4,
[lang] TEXT NOT NULL DEFAULT 'en',
-- 0: Monday, 1: Tuesday, 2: Wednesday, 3: Thursday, 4: Friday, 5: Saturday, 6: Sunday.
[first_day_of_the_week] INTEGER DEFAULT 0,
[password] TEXT NOT NULL, -- argon2(password_plain, salt).
@ -34,6 +36,17 @@ CREATE TABLE [User] (
CREATE INDEX [validation_token_index] ON [User]([validation_token]);
CREATE UNIQUE INDEX [User_email_index] ON [User]([email]);
CREATE TRIGGER [User_trigger_update_first_day_of_the_week]
BEFORE UPDATE OF [first_day_of_the_week]
ON [User]
BEGIN
SELECT
CASE
WHEN NEW.[first_day_of_the_week] < 0 OR NEW.[first_day_of_the_week] > 6 THEN
RAISE (ABORT, 'Invalid [first_day_of_the_week] value')
END;
END;
CREATE TABLE [UserLoginToken] (
[id] INTEGER PRIMARY KEY,
[user_id] INTEGER NOT NULL,