From 8a3bd7e3d3e2550d5eebf8fa02a6291b607e05a4 Mon Sep 17 00:00:00 2001 From: Alexander Fritsch <35202909+loudar@users.noreply.github.com> Date: Fri, 7 Jun 2024 20:14:34 +0200 Subject: [PATCH] work on settings --- emoji-generation/generateJson.ts | 1 - src/features/database/models.ts | 9 +++++++++ updateDb.sql | 12 ++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/emoji-generation/generateJson.ts b/emoji-generation/generateJson.ts index f177763..39373cd 100644 --- a/emoji-generation/generateJson.ts +++ b/emoji-generation/generateJson.ts @@ -1,5 +1,4 @@ import fs from "fs"; -import path from "path"; import {Reaction, ReactionGroup} from "../src/features/database/models"; const source = "emojis.json"; diff --git a/src/features/database/models.ts b/src/features/database/models.ts index 84cff65..191b259 100644 --- a/src/features/database/models.ts +++ b/src/features/database/models.ts @@ -48,6 +48,7 @@ export interface ImageAttachment { export interface MessageReaction { 'messageId': Id; 'reactionId': Id; + 'userId': Id; } export interface Message { @@ -111,3 +112,11 @@ export interface User { 'username': string; } +export interface UserSetting { + 'createdAt': Date; + 'settingKey': string; + 'updatedAt': Date; + 'userId': Id; + 'value': string; +} + diff --git a/updateDb.sql b/updateDb.sql index 3b70b23..3250f44 100644 --- a/updateDb.sql +++ b/updateDb.sql @@ -221,3 +221,15 @@ create table if not exists venel.userRoles on delete cascade ); +create table if not exists venel.userSettings +( + userId bigint not null, + settingKey varchar(32) not null, + value varchar(32) not null, + createdAt datetime default current_timestamp() not null, + updatedAt datetime default current_timestamp() not null on update current_timestamp(), + primary key (settingKey, userId), + constraint userSettings_users_id_fk + foreign key (userId) references venel.users (id) + on delete cascade +);