From 8bffebfd361b1c562ac2ff2a915836c65d00fb2a Mon Sep 17 00:00:00 2001 From: beo3000 Date: Wed, 25 Feb 2026 08:26:42 +0100 Subject: [PATCH] feat: pages is_favorite, commandbar improvements, wiki ui Co-Authored-By: Claude Sonnet 4.6 --- docs/feature-commandbar.md | 21 +- ka-note/VERSION | 2 +- .../src/lib/components/CommandBar.svelte | 20 +- ka-note/client/src/routes/wiki/+page.svelte | 35 +- .../server/drizzle/0011_pages_is_favorite.sql | 1 + .../server/drizzle/0012_chunky_stature.sql | 1 + .../server/drizzle/meta/0012_snapshot.json | 1145 +++++++++++++++++ ka-note/server/drizzle/meta/_journal.json | 14 + ka-note/server/src/db/schema.ts | 1 + ka-note/server/src/lib/sync-service.ts | 3 +- 10 files changed, 1213 insertions(+), 30 deletions(-) create mode 100644 ka-note/server/drizzle/0011_pages_is_favorite.sql create mode 100644 ka-note/server/drizzle/0012_chunky_stature.sql create mode 100644 ka-note/server/drizzle/meta/0012_snapshot.json diff --git a/docs/feature-commandbar.md b/docs/feature-commandbar.md index 526b090..cc86c48 100644 --- a/docs/feature-commandbar.md +++ b/docs/feature-commandbar.md @@ -50,12 +50,29 @@ Beim Tippen werden **Contexts** (Jour Fixes, Projekte, Firmen, Personen) und **W ## Slash-Commands +Scope-dynamische Commands verwenden den aktuell aktiven Scope (Privat/Firma). Scope-explizite Varianten mit Präfix `p` (Privat) oder `b` (Business/Firma) überschreiben den aktiven Scope. + | Command | Funktion | |---------|----------| -| `/note [Text]` | Neues Topic im Daily Log erstellen | -| `/todo [Text]` | Topic mit Wiedervorlage (heute) im Daily Log | +| `/note [Text]` | Neues Topic im Daily Log (aktiver Scope) | +| `/pnote [Text]` | Neues Topic im Daily Log (Privat) | +| `/bnote [Text]` | Neues Topic im Daily Log (Firma) | +| `/todo [Text]` | Topic mit Wiedervorlage heute (aktiver Scope) | +| `/ptodo [Text]` | Topic mit Wiedervorlage heute (Privat) | +| `/btodo [Text]` | Topic mit Wiedervorlage heute (Firma) | +| `/page [Titel]` | Neue Wiki-Seite erstellen (aktiver Scope) | +| `/ppage [Titel]` | Neue Wiki-Seite erstellen (Privat) | +| `/bpage [Titel]` | Neue Wiki-Seite erstellen (Firma) | +| `/person [Name]` | Neuen Personen-Kontext erstellen (aktiver Scope) | +| `/pperson [Name]` | Neuen Personen-Kontext erstellen (Privat) | +| `/bperson [Name]` | Neuen Personen-Kontext erstellen (Firma) | +| `/firma [Name]` | Neuen Firmen-Kontext erstellen (aktiver Scope) | +| `/pfirma [Name]` | Neuen Firmen-Kontext erstellen (Privat) | +| `/bfirma [Name]` | Neuen Firmen-Kontext erstellen (Firma) | | `/jf [Name]` | Zu passendem Jour-Fix-Kontext springen | +Scope-spezifische Commands erscheinen in der Bar erst ab dem zweiten Zeichen (`/p...` / `/b...`), um Duplikate mit den scope-dynamischen Commands zu vermeiden. + Beispiel: `/note Anruf bei Steffen wegen Angebot` → sofort als Topic in `daily-log` gespeichert, ohne den aktuellen Screen zu verlassen. --- diff --git a/ka-note/VERSION b/ka-note/VERSION index bf29cfe..ebb907e 100644 --- a/ka-note/VERSION +++ b/ka-note/VERSION @@ -1 +1 @@ -1.1.68 \ No newline at end of file +1.1.71 \ No newline at end of file diff --git a/ka-note/client/src/lib/components/CommandBar.svelte b/ka-note/client/src/lib/components/CommandBar.svelte index a995b5b..f837380 100644 --- a/ka-note/client/src/lib/components/CommandBar.svelte +++ b/ka-note/client/src/lib/components/CommandBar.svelte @@ -100,7 +100,8 @@ const actions = []; - if ("/note".startsWith(cmd)) { + // Show scope-dynamic /note only when not narrowed to /pnote or /bnote + if ("/note".startsWith(cmd) && !"/pnote".startsWith(cmd) && !"/bnote".startsWith(cmd)) { actions.push({ id: "cmd-note", type: "action", @@ -117,7 +118,7 @@ }); } - if ("/pnote".startsWith(cmd)) { + if ("/pnote".startsWith(cmd) && cmd.length > 1) { actions.push({ id: "cmd-pnote", type: "action", @@ -133,7 +134,7 @@ }); } - if ("/bnote".startsWith(cmd)) { + if ("/bnote".startsWith(cmd) && cmd.length > 1) { actions.push({ id: "cmd-bnote", type: "action", @@ -149,7 +150,8 @@ }); } - if ("/todo".startsWith(cmd)) { + // Show scope-dynamic /todo only when not narrowed to /ptodo or /btodo + if ("/todo".startsWith(cmd) && !"/ptodo".startsWith(cmd) && !"/btodo".startsWith(cmd)) { actions.push({ id: "cmd-todo", type: "action", @@ -166,7 +168,7 @@ }); } - if ("/ptodo".startsWith(cmd)) { + if ("/ptodo".startsWith(cmd) && cmd.length > 1) { actions.push({ id: "cmd-ptodo", type: "action", @@ -182,7 +184,7 @@ }); } - if ("/btodo".startsWith(cmd)) { + if ("/btodo".startsWith(cmd) && cmd.length > 1) { actions.push({ id: "cmd-btodo", type: "action", @@ -198,7 +200,7 @@ }); } - if ("/page".startsWith(cmd)) { + if ("/page".startsWith(cmd) && !"/ppage".startsWith(cmd) && !"/bpage".startsWith(cmd)) { actions.push({ id: "cmd-page", type: "action", @@ -217,7 +219,7 @@ }); } - if ("/ppage".startsWith(cmd)) { + if ("/ppage".startsWith(cmd) && cmd.length > 1) { actions.push({ id: "cmd-ppage", type: "action", @@ -235,7 +237,7 @@ }); } - if ("/bpage".startsWith(cmd)) { + if ("/bpage".startsWith(cmd) && cmd.length > 1) { actions.push({ id: "cmd-bpage", type: "action", diff --git a/ka-note/client/src/routes/wiki/+page.svelte b/ka-note/client/src/routes/wiki/+page.svelte index b3305e7..0e1876d 100644 --- a/ka-note/client/src/routes/wiki/+page.svelte +++ b/ka-note/client/src/routes/wiki/+page.svelte @@ -96,9 +96,9 @@
-
+
- - {#if activeTab === 'notebooks'} -
- - -
- {/if}
+ + {#if activeTab === 'notebooks'} +
+ + +
+ {/if} + {#if activeTab === 'notebooks'}
diff --git a/ka-note/server/drizzle/0011_pages_is_favorite.sql b/ka-note/server/drizzle/0011_pages_is_favorite.sql new file mode 100644 index 0000000..5a1176e --- /dev/null +++ b/ka-note/server/drizzle/0011_pages_is_favorite.sql @@ -0,0 +1 @@ +-- no-op: is_favorite column added in 0012_chunky_stature.sql diff --git a/ka-note/server/drizzle/0012_chunky_stature.sql b/ka-note/server/drizzle/0012_chunky_stature.sql new file mode 100644 index 0000000..dc12f21 --- /dev/null +++ b/ka-note/server/drizzle/0012_chunky_stature.sql @@ -0,0 +1 @@ +ALTER TABLE `pages` ADD `is_favorite` integer DEFAULT false NOT NULL; \ No newline at end of file diff --git a/ka-note/server/drizzle/meta/0012_snapshot.json b/ka-note/server/drizzle/meta/0012_snapshot.json new file mode 100644 index 0000000..d19df48 --- /dev/null +++ b/ka-note/server/drizzle/meta/0012_snapshot.json @@ -0,0 +1,1145 @@ +{ + "version": "6", + "dialect": "sqlite", + "id": "d8154271-c91d-4ad4-b288-7c09662cd1dc", + "prevId": "ca4e7623-eede-4261-a698-3b5fcd27a3f1", + "tables": { + "ai_locks": { + "name": "ai_locks", + "columns": { + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "locked_at": { + "name": "locked_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "expires_at": { + "name": "expires_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "api_keys": { + "name": "api_keys", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "key_hash": { + "name": "key_hash", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "last_used_at": { + "name": "last_used_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "api_keys_key_hash_unique": { + "name": "api_keys_key_hash_unique", + "columns": [ + "key_hash" + ], + "isUnique": true + }, + "api_keys_user_id_idx": { + "name": "api_keys_user_id_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "api_keys_key_hash_idx": { + "name": "api_keys_key_hash_idx", + "columns": [ + "key_hash" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "contexts": { + "name": "contexts", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "meta": { + "name": "meta", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "archived_at": { + "name": "archived_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_favorite": { + "name": "is_favorite", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "purged_at": { + "name": "purged_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 1 + } + }, + "indexes": { + "contexts_updated_at_idx": { + "name": "contexts_updated_at_idx", + "columns": [ + "updated_at" + ], + "isUnique": false + }, + "contexts_user_id_idx": { + "name": "contexts_user_id_idx", + "columns": [ + "user_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "contexts_id_user_id_pk": { + "columns": [ + "id", + "user_id" + ], + "name": "contexts_id_user_id_pk" + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "history_entries": { + "name": "history_entries", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "topic_id": { + "name": "topic_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "date": { + "name": "date", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "text": { + "name": "text", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "linked_context_id": { + "name": "linked_context_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "done_at": { + "name": "done_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "wiedervorlage_date": { + "name": "wiedervorlage_date", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "wiedervorlage_resolved_at": { + "name": "wiedervorlage_resolved_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_private": { + "name": "is_private", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "purged_at": { + "name": "purged_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 1 + } + }, + "indexes": { + "history_entries_updated_at_idx": { + "name": "history_entries_updated_at_idx", + "columns": [ + "updated_at" + ], + "isUnique": false + }, + "history_entries_topic_id_idx": { + "name": "history_entries_topic_id_idx", + "columns": [ + "topic_id" + ], + "isUnique": false + }, + "history_entries_user_id_idx": { + "name": "history_entries_user_id_idx", + "columns": [ + "user_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "history_entries_topic_id_user_id_topics_id_user_id_fk": { + "name": "history_entries_topic_id_user_id_topics_id_user_id_fk", + "tableFrom": "history_entries", + "tableTo": "topics", + "columnsFrom": [ + "topic_id", + "user_id" + ], + "columnsTo": [ + "id", + "user_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "history_entries_id_user_id_pk": { + "columns": [ + "id", + "user_id" + ], + "name": "history_entries_id_user_id_pk" + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "image_blobs": { + "name": "image_blobs", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "mime_type": { + "name": "mime_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "content_hash": { + "name": "content_hash", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "data": { + "name": "data", + "type": "blob", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 1 + } + }, + "indexes": { + "image_blobs_user_id_idx": { + "name": "image_blobs_user_id_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "image_blobs_content_hash_idx": { + "name": "image_blobs_content_hash_idx", + "columns": [ + "content_hash" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "image_blobs_id_user_id_pk": { + "columns": [ + "id", + "user_id" + ], + "name": "image_blobs_id_user_id_pk" + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "notebooks": { + "name": "notebooks", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "context_id": { + "name": "context_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_private": { + "name": "is_private", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "is_favorite": { + "name": "is_favorite", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "purged_at": { + "name": "purged_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 1 + } + }, + "indexes": { + "notebooks_updated_at_idx": { + "name": "notebooks_updated_at_idx", + "columns": [ + "updated_at" + ], + "isUnique": false + }, + "notebooks_user_id_idx": { + "name": "notebooks_user_id_idx", + "columns": [ + "user_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "notebooks_id_user_id_pk": { + "columns": [ + "id", + "user_id" + ], + "name": "notebooks_id_user_id_pk" + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "page_notebooks": { + "name": "page_notebooks", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "page_id": { + "name": "page_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "notebook_id": { + "name": "notebook_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "purged_at": { + "name": "purged_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 1 + } + }, + "indexes": { + "page_notebooks_updated_at_idx": { + "name": "page_notebooks_updated_at_idx", + "columns": [ + "updated_at" + ], + "isUnique": false + }, + "page_notebooks_page_id_idx": { + "name": "page_notebooks_page_id_idx", + "columns": [ + "page_id" + ], + "isUnique": false + }, + "page_notebooks_notebook_id_idx": { + "name": "page_notebooks_notebook_id_idx", + "columns": [ + "notebook_id" + ], + "isUnique": false + }, + "page_notebooks_user_id_idx": { + "name": "page_notebooks_user_id_idx", + "columns": [ + "user_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "page_notebooks_id_user_id_pk": { + "columns": [ + "id", + "user_id" + ], + "name": "page_notebooks_id_user_id_pk" + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "pages": { + "name": "pages", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "body": { + "name": "body", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "''" + }, + "is_private": { + "name": "is_private", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "is_favorite": { + "name": "is_favorite", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "purged_at": { + "name": "purged_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 1 + } + }, + "indexes": { + "pages_updated_at_idx": { + "name": "pages_updated_at_idx", + "columns": [ + "updated_at" + ], + "isUnique": false + }, + "pages_user_id_idx": { + "name": "pages_user_id_idx", + "columns": [ + "user_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "pages_id_user_id_pk": { + "columns": [ + "id", + "user_id" + ], + "name": "pages_id_user_id_pk" + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "ratings": { + "name": "ratings", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "topic_id": { + "name": "topic_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "history_entry_id": { + "name": "history_entry_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "person_name": { + "name": "person_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "value": { + "name": "value", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "purged_at": { + "name": "purged_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 1 + } + }, + "indexes": { + "ratings_updated_at_idx": { + "name": "ratings_updated_at_idx", + "columns": [ + "updated_at" + ], + "isUnique": false + }, + "ratings_topic_id_idx": { + "name": "ratings_topic_id_idx", + "columns": [ + "topic_id" + ], + "isUnique": false + }, + "ratings_user_id_idx": { + "name": "ratings_user_id_idx", + "columns": [ + "user_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "ratings_topic_id_user_id_topics_id_user_id_fk": { + "name": "ratings_topic_id_user_id_topics_id_user_id_fk", + "tableFrom": "ratings", + "tableTo": "topics", + "columnsFrom": [ + "topic_id", + "user_id" + ], + "columnsTo": [ + "id", + "user_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "ratings_history_entry_id_user_id_history_entries_id_user_id_fk": { + "name": "ratings_history_entry_id_user_id_history_entries_id_user_id_fk", + "tableFrom": "ratings", + "tableTo": "history_entries", + "columnsFrom": [ + "history_entry_id", + "user_id" + ], + "columnsTo": [ + "id", + "user_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "ratings_id_user_id_pk": { + "columns": [ + "id", + "user_id" + ], + "name": "ratings_id_user_id_pk" + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "topics": { + "name": "topics", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "context_id": { + "name": "context_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'active'" + }, + "snooze_until": { + "name": "snooze_until", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "is_new": { + "name": "is_new", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": true + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "purged_at": { + "name": "purged_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 1 + } + }, + "indexes": { + "topics_updated_at_idx": { + "name": "topics_updated_at_idx", + "columns": [ + "updated_at" + ], + "isUnique": false + }, + "topics_context_id_idx": { + "name": "topics_context_id_idx", + "columns": [ + "context_id" + ], + "isUnique": false + }, + "topics_user_id_idx": { + "name": "topics_user_id_idx", + "columns": [ + "user_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "topics_context_id_user_id_contexts_id_user_id_fk": { + "name": "topics_context_id_user_id_contexts_id_user_id_fk", + "tableFrom": "topics", + "tableTo": "contexts", + "columnsFrom": [ + "context_id", + "user_id" + ], + "columnsTo": [ + "id", + "user_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "topics_id_user_id_pk": { + "columns": [ + "id", + "user_id" + ], + "name": "topics_id_user_id_pk" + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + } + }, + "views": {}, + "enums": {}, + "_meta": { + "schemas": {}, + "tables": {}, + "columns": {} + }, + "internal": { + "indexes": {} + } +} \ No newline at end of file diff --git a/ka-note/server/drizzle/meta/_journal.json b/ka-note/server/drizzle/meta/_journal.json index 12d687a..f33705e 100644 --- a/ka-note/server/drizzle/meta/_journal.json +++ b/ka-note/server/drizzle/meta/_journal.json @@ -78,6 +78,20 @@ "when": 1771857652883, "tag": "0010_sharp_bishop", "breakpoints": true + }, + { + "idx": 11, + "version": "6", + "when": 1771900000000, + "tag": "0011_pages_is_favorite", + "breakpoints": true + }, + { + "idx": 12, + "version": "6", + "when": 1772004047537, + "tag": "0012_chunky_stature", + "breakpoints": true } ] } \ No newline at end of file diff --git a/ka-note/server/src/db/schema.ts b/ka-note/server/src/db/schema.ts index 0fa85b9..511cd5a 100644 --- a/ka-note/server/src/db/schema.ts +++ b/ka-note/server/src/db/schema.ts @@ -85,6 +85,7 @@ export const pages = sqliteTable('pages', { title: text('title').notNull(), body: text('body').notNull().default(''), isPrivate: integer('is_private', { mode: 'boolean' }).notNull().default(false), + isFavorite: integer('is_favorite', { mode: 'boolean' }).notNull().default(false), sortOrder: integer('sort_order').notNull().default(0), updatedAt: text('updated_at').notNull(), deletedAt: text('deleted_at'), diff --git a/ka-note/server/src/lib/sync-service.ts b/ka-note/server/src/lib/sync-service.ts index 0a552d9..f521190 100644 --- a/ka-note/server/src/lib/sync-service.ts +++ b/ka-note/server/src/lib/sync-service.ts @@ -85,6 +85,7 @@ function mapPage(row: typeof pages.$inferSelect): Page { title: row.title, body: row.body, isPrivate: row.isPrivate, + isFavorite: row.isFavorite, sortOrder: row.sortOrder, updatedAt: row.updatedAt, deletedAt: row.deletedAt, @@ -276,7 +277,7 @@ export async function pushChanges(request: SyncPushRequest, userId: string): Pro } for (const pg of pgs) { - const row = { id: pg.id, userId, title: pg.title, body: pg.body, isPrivate: pg.isPrivate, sortOrder: pg.sortOrder, updatedAt: pg.updatedAt, deletedAt: pg.deletedAt, purgedAt: pg.purgedAt ?? null, version: pg.version }; + const row = { id: pg.id, userId, title: pg.title, body: pg.body, isPrivate: pg.isPrivate, isFavorite: pg.isFavorite ?? false, sortOrder: pg.sortOrder, updatedAt: pg.updatedAt, deletedAt: pg.deletedAt, purgedAt: pg.purgedAt ?? null, version: pg.version }; if (await upsertEntity(pages, row, conflicts, 'page', userId)) accepted++; }