aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/client/sync/crdt/document-manager.ts
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-02-25 23:02:35 +0900
committernsfisis <nsfisis@gmail.com>2026-02-25 23:02:35 +0900
commit38b8fc0e9927c4146b4c8b309b2bcc644abd63d0 (patch)
treef76ba23251645e552fccd201362064b06de50bdd /src/client/sync/crdt/document-manager.ts
parent7a77e72bb49ed3990a0c4581292a37a8a4f35231 (diff)
downloadkioku-38b8fc0e9927c4146b4c8b309b2bcc644abd63d0.tar.gz
kioku-38b8fc0e9927c4146b4c8b309b2bcc644abd63d0.tar.zst
kioku-38b8fc0e9927c4146b4c8b309b2bcc644abd63d0.zip
feat(decks): add default note type setting per deckHEADmain
Allow each deck to specify a default note type that is auto-selected when creating new notes. Includes DB schema migration, server API updates, sync layer support, and UI for editing the default in the deck settings modal. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'src/client/sync/crdt/document-manager.ts')
-rw-r--r--src/client/sync/crdt/document-manager.ts3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/client/sync/crdt/document-manager.ts b/src/client/sync/crdt/document-manager.ts
index b753d88..ab121ec 100644
--- a/src/client/sync/crdt/document-manager.ts
+++ b/src/client/sync/crdt/document-manager.ts
@@ -187,6 +187,7 @@ function getEmptyDocumentData(
userId: "",
name: "",
description: null,
+ defaultNoteTypeId: null,
createdAt: 0,
deletedAt: null,
},
@@ -300,6 +301,7 @@ export function deckToCrdtDocument(deck: LocalDeck): CrdtDeckDocument {
userId: deck.userId,
name: deck.name,
description: deck.description,
+ defaultNoteTypeId: deck.defaultNoteTypeId,
createdAt: deck.createdAt.getTime(),
deletedAt: deck.deletedAt?.getTime() ?? null,
},
@@ -317,6 +319,7 @@ export function crdtDocumentToDeck(
userId: doc.data.userId,
name: doc.data.name,
description: doc.data.description,
+ defaultNoteTypeId: doc.data.defaultNoteTypeId ?? null,
createdAt: new Date(doc.data.createdAt),
updatedAt: new Date(doc.meta.lastModified),
deletedAt: doc.data.deletedAt ? new Date(doc.data.deletedAt) : null,