From a490c6dd68470b1be1abac73b00246b07e6bd919 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Wed, 31 Dec 2025 14:27:54 +0900 Subject: feat(card): cascade card deletion to note and sibling cards MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a card is deleted, now also soft-deletes its parent Note and all sibling cards (other cards generated from the same note). This matches the specified behavior in the roadmap where deleting any card from a note-based group should remove the entire note and all its cards. Also adds tests for deletion constraint behaviors: - NoteType deletion blocked when Notes exist - NoteFieldType deletion blocked when NoteFieldValues exist - Note deletion cascades to all related Cards - Card deletion cascades to Note and sibling Cards 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- src/client/db/repositories.test.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/client') diff --git a/src/client/db/repositories.test.ts b/src/client/db/repositories.test.ts index da0f0d3..448cb9e 100644 --- a/src/client/db/repositories.test.ts +++ b/src/client/db/repositories.test.ts @@ -262,8 +262,20 @@ describe("localCardRepository", () => { describe("findByDeckId", () => { it("should return all cards for a deck", async () => { - await localCardRepository.create({ deckId, noteId: "test-note-id", isReversed: false, front: "Q1", back: "A1" }); - await localCardRepository.create({ deckId, noteId: "test-note-id-2", isReversed: false, front: "Q2", back: "A2" }); + await localCardRepository.create({ + deckId, + noteId: "test-note-id", + isReversed: false, + front: "Q1", + back: "A1", + }); + await localCardRepository.create({ + deckId, + noteId: "test-note-id-2", + isReversed: false, + front: "Q2", + back: "A2", + }); const cards = await localCardRepository.findByDeckId(deckId); expect(cards).toHaveLength(2); -- cgit v1.2.3-70-g09d2