From 09652176f97f11bc06f4c9b57a448e14744eac12 Mon Sep 17 00:00:00 2001 From: Mohamed Bassem Date: Sat, 24 May 2025 12:59:43 +0000 Subject: feat: Allow defaulting to reader mode when clicking on bookmarks. Fixes #662 --- packages/db/schema.ts | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'packages/db/schema.ts') diff --git a/packages/db/schema.ts b/packages/db/schema.ts index b5938989..0e8167c7 100644 --- a/packages/db/schema.ts +++ b/packages/db/schema.ts @@ -527,13 +527,27 @@ export const ruleEngineActionsTable = sqliteTable( ], ); +export const userSettings = sqliteTable("userSettings", { + userId: text("userId") + .notNull() + .primaryKey() + .references(() => users.id, { onDelete: "cascade" }), + bookmarkClickAction: text("bookmarkClickAction", { + enum: ["open_original_link", "expand_bookmark_preview"], + }).notNull().default("open_original_link"), +}); + // Relations -export const userRelations = relations(users, ({ many }) => ({ +export const userRelations = relations(users, ({ many, one }) => ({ tags: many(bookmarkTags), bookmarks: many(bookmarks), webhooks: many(webhooksTable), rules: many(ruleEngineRulesTable), + settings: one(userSettings, { + fields: [users.id], + references: [userSettings.userId], + }), })); export const bookmarkRelations = relations(bookmarks, ({ many, one }) => ({ @@ -668,3 +682,10 @@ export const rssFeedImportsTableRelations = relations( }), }), ); + +export const userSettingsRelations = relations(userSettings, ({ one }) => ({ + user: one(users, { + fields: [userSettings.userId], + references: [users.id], + }), +})); -- cgit v1.2.3-70-g09d2