diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-12-31 14:27:54 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-12-31 14:27:54 +0900 |
| commit | a490c6dd68470b1be1abac73b00246b07e6bd919 (patch) | |
| tree | 24abecf2556e0fa22887e5d8ff331e6105ff6377 /src/client/db | |
| parent | a4a03abe7ad5a52df72b538dd206b58d85d912e4 (diff) | |
| download | kioku-a490c6dd68470b1be1abac73b00246b07e6bd919.tar.gz kioku-a490c6dd68470b1be1abac73b00246b07e6bd919.tar.zst kioku-a490c6dd68470b1be1abac73b00246b07e6bd919.zip | |
feat(card): cascade card deletion to note and sibling cards
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 <noreply@anthropic.com>
Diffstat (limited to 'src/client/db')
| -rw-r--r-- | src/client/db/repositories.test.ts | 16 |
1 files changed, 14 insertions, 2 deletions
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); |
