Add character deletion functionality with confirmation workflow

- Added `handleDeleteCharacter` method to handle character deletion with confirmation prompts.
- Updated `CharacterComponent` and `CharacterDetail` to include delete button and related logic.
- Localized new strings for character deletion (e.g., confirmation prompts, success/error messages).
- Enhanced database repository methods (`deleteCharacter`) to handle character deletion securely.
- Improved synchronization workflows to accommodate character deletion.
This commit is contained in:
natreex
2026-01-22 15:09:04 -05:00
parent 9461eb6120
commit 4e462670a9
16 changed files with 383 additions and 59 deletions

View File

@@ -25,6 +25,8 @@ import WorldRepository, {
BookWorldTable
} from "../repositories/world.repository.js";
import ChapterContentRepository, { BookChapterContentTable } from "../repositories/chaptercontent.repository.js";
import SpellRepo, { BookSpellsTable } from "../repositories/spell.repo.js";
import SpellTagRepo, { BookSpellTagsTable } from "../repositories/spelltag.repo.js";
export default class Upload {
/**
@@ -52,7 +54,9 @@ export default class Upload {
encryptedLocations,
encryptedPlotPoints,
encryptedWorlds,
bookToolsData
bookToolsData,
encryptedSpells,
encryptedSpellTags
]: [
EritBooksTable[],
BookActSummariesTable[],
@@ -65,7 +69,9 @@ export default class Upload {
BookLocationTable[],
BookPlotPointsTable[],
BookWorldTable[],
BookToolsTable | null
BookToolsTable | null,
BookSpellsTable[],
BookSpellTagsTable[]
] = await Promise.all([
BookRepo.fetchEritBooksTable(userId, bookId, lang),
ActRepository.fetchBookActSummaries(userId, bookId, lang),
@@ -78,7 +84,9 @@ export default class Upload {
LocationRepo.fetchBookLocations(userId, bookId, lang),
PlotPointRepository.fetchBookPlotPoints(userId, bookId, lang),
WorldRepository.fetchBookWorlds(userId, bookId, lang),
BookRepo.fetchBookTools(userId, bookId, lang)
BookRepo.fetchBookTools(userId, bookId, lang),
SpellRepo.fetchBookSpellsTable(userId, bookId, lang),
SpellTagRepo.fetchBookSpellTagsTable(userId, bookId, lang)
]);
const [
@@ -239,6 +247,23 @@ export default class Upload {
const bookTools: BookToolsTable[] = bookToolsData ? [bookToolsData] : [];
const spells: BookSpellsTable[] = encryptedSpells.map((spell: BookSpellsTable): BookSpellsTable => ({
...spell,
name: System.decryptDataWithUserKey(spell.name, userEncryptionKey),
description: System.decryptDataWithUserKey(spell.description, userEncryptionKey),
appearance: System.decryptDataWithUserKey(spell.appearance, userEncryptionKey),
tags: System.decryptDataWithUserKey(spell.tags, userEncryptionKey),
power_level: spell.power_level ? System.decryptDataWithUserKey(spell.power_level, userEncryptionKey) : null,
components: spell.components ? System.decryptDataWithUserKey(spell.components, userEncryptionKey) : null,
limitations: spell.limitations ? System.decryptDataWithUserKey(spell.limitations, userEncryptionKey) : null,
notes: spell.notes ? System.decryptDataWithUserKey(spell.notes, userEncryptionKey) : null
}));
const spellTags: BookSpellTagsTable[] = encryptedSpellTags.map((spellTag: BookSpellTagsTable): BookSpellTagsTable => ({
...spellTag,
name: System.decryptDataWithUserKey(spellTag.name, userEncryptionKey)
}));
return {
eritBooks,
actSummaries,
@@ -257,7 +282,9 @@ export default class Upload {
worldElements,
locationElements,
locationSubElements,
bookTools
bookTools,
spells,
spellTags
};
}
}