From b074a4901c630ee5c5f7dcff79fa6ff911a14ded Mon Sep 17 00:00:00 2001 From: nsfisis Date: Wed, 31 Dec 2025 14:19:22 +0900 Subject: feat(schema): make note_id and is_reversed NOT NULL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All cards now require note association - legacy card support removed. This aligns with the note-based card architecture introduced in Phase 8. - Add database migration for NOT NULL constraints - Update client Dexie schema to version 3 - Remove LegacyCardItem component and legacy card handling - Update sync schemas and type definitions - Update all tests to use note-based cards 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- src/server/routes/study.test.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/server/routes/study.test.ts') diff --git a/src/server/routes/study.test.ts b/src/server/routes/study.test.ts index 41abecd..e2fb457 100644 --- a/src/server/routes/study.test.ts +++ b/src/server/routes/study.test.ts @@ -80,8 +80,8 @@ function createMockCard(overrides: Partial = {}): Card { return { id: "card-uuid-123", deckId: "deck-uuid-123", - noteId: null, - isReversed: null, + noteId: "note-uuid-123", + isReversed: false, front: "Question", back: "Answer", state: CardState.New, @@ -122,7 +122,10 @@ function createMockCardForStudy( ): CardForStudy { return { ...createMockCard(overrides), - noteType: overrides.noteType ?? null, + noteType: overrides.noteType ?? { + frontTemplate: "{{Front}}", + backTemplate: "{{Back}}", + }, fieldValuesMap: overrides.fieldValuesMap ?? {}, }; } @@ -187,20 +190,18 @@ describe("GET /api/decks/:deckId/study", () => { ); }); - it("returns due cards (legacy cards without note)", async () => { + it("returns due cards", async () => { const mockCards = [ createMockCardForStudy({ id: "card-1", front: "Q1", back: "A1", - noteType: null, fieldValuesMap: {}, }), createMockCardForStudy({ id: "card-2", front: "Q2", back: "A2", - noteType: null, fieldValuesMap: {}, }), ]; @@ -217,7 +218,7 @@ describe("GET /api/decks/:deckId/study", () => { expect(res.status).toBe(200); const body = (await res.json()) as StudyResponse; expect(body.cards).toHaveLength(2); - expect(body.cards?.[0]?.noteType).toBeNull(); + expect(body.cards?.[0]?.noteType).toBeDefined(); }); it("returns due cards with note type and field values when available", async () => { -- cgit v1.2.3-70-g09d2