From 38b8fc0e9927c4146b4c8b309b2bcc644abd63d0 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Wed, 25 Feb 2026 23:02:35 +0900 Subject: feat(decks): add default note type setting per deck 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 --- src/client/db/repositories.test.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/client/db/repositories.test.ts') diff --git a/src/client/db/repositories.test.ts b/src/client/db/repositories.test.ts index b461990..6a77760 100644 --- a/src/client/db/repositories.test.ts +++ b/src/client/db/repositories.test.ts @@ -33,6 +33,7 @@ describe("localDeckRepository", () => { userId: "user-1", name: "Test Deck", description: "A test deck", + defaultNoteTypeId: null, }); expect(deck.id).toBeDefined(); @@ -51,6 +52,7 @@ describe("localDeckRepository", () => { userId: "user-1", name: "Test Deck", description: null, + defaultNoteTypeId: null, }); const found = await db.decks.get(created.id); @@ -64,6 +66,7 @@ describe("localDeckRepository", () => { userId: "user-1", name: "Test Deck", description: null, + defaultNoteTypeId: null, }); const found = await localDeckRepository.findById(created.id); @@ -82,16 +85,19 @@ describe("localDeckRepository", () => { userId: "user-1", name: "Deck 1", description: null, + defaultNoteTypeId: null, }); await localDeckRepository.create({ userId: "user-1", name: "Deck 2", description: null, + defaultNoteTypeId: null, }); await localDeckRepository.create({ userId: "user-2", name: "Other User Deck", description: null, + defaultNoteTypeId: null, }); const decks = await localDeckRepository.findByUserId("user-1"); @@ -104,6 +110,7 @@ describe("localDeckRepository", () => { userId: "user-1", name: "Deleted Deck", description: null, + defaultNoteTypeId: null, }); await localDeckRepository.delete(deck.id); @@ -118,6 +125,7 @@ describe("localDeckRepository", () => { userId: "user-1", name: "Original Name", description: null, + defaultNoteTypeId: null, }); const updated = await localDeckRepository.update(deck.id, { @@ -147,6 +155,7 @@ describe("localDeckRepository", () => { userId: "user-1", name: "Test Deck", description: null, + defaultNoteTypeId: null, }); const result = await localDeckRepository.delete(deck.id); @@ -169,11 +178,13 @@ describe("localDeckRepository", () => { userId: "user-1", name: "Unsynced", description: null, + defaultNoteTypeId: null, }); const deck2 = await localDeckRepository.create({ userId: "user-1", name: "Synced", description: null, + defaultNoteTypeId: null, }); await localDeckRepository.markSynced(deck2.id, 1); @@ -189,6 +200,7 @@ describe("localDeckRepository", () => { userId: "user-1", name: "Test", description: null, + defaultNoteTypeId: null, }); await localDeckRepository.markSynced(deck.id, 5); @@ -212,6 +224,7 @@ describe("localCardRepository", () => { userId: "user-1", name: "Test Deck", description: null, + defaultNoteTypeId: null, }); deckId = deck.id; }); @@ -411,6 +424,7 @@ describe("localReviewLogRepository", () => { userId: "user-1", name: "Test Deck", description: null, + defaultNoteTypeId: null, }); deckId = deck.id; @@ -935,6 +949,7 @@ describe("localNoteRepository", () => { userId: "user-1", name: "Test Deck", description: null, + defaultNoteTypeId: null, }); deckId = deck.id; @@ -1094,6 +1109,7 @@ describe("localNoteFieldValueRepository", () => { userId: "user-1", name: "Test Deck", description: null, + defaultNoteTypeId: null, }); const noteType = await localNoteTypeRepository.create({ -- cgit v1.3-1-g0d28