Add error handling, enhance syncing, and refactor deletion logic

- Introduce new error messages for syncing and book deletion in `en.json`.
- Update `DeleteBook` to support local-only deletion and synced book management.
- Refine offline/online behavior with `deleteLocalToo` checkbox and update related state handling.
- Extend repository and IPC methods to handle optional IDs for updates.
- Add `SyncQueueContext` for queueing offline changes and improving synchronization workflows.
- Enhance refined text generation logic in `DraftCompanion` and `GhostWriter` components.
- Replace PUT with PATCH for world updates to align with API expectations.
- Streamline `AlertBox` by integrating dynamic translation keys for deletion prompts.
This commit is contained in:
natreex
2026-01-10 15:50:03 -05:00
parent 060693f152
commit 7f34421212
26 changed files with 506 additions and 100 deletions

View File

@@ -6,12 +6,14 @@ import type { CharacterProps, CharacterPropsPost, CharacterAttribute } from '../
interface AddCharacterData {
character: CharacterPropsPost;
bookId: string;
id?: string;
}
interface AddAttributeData {
characterId: string;
type: string;
name: string;
id?: string;
}
// GET /character/list - Get character list
@@ -39,7 +41,7 @@ ipcMain.handle('db:character:attributes', createHandler<GetCharacterAttributesDa
// POST /character/add - Add new character
ipcMain.handle('db:character:create', createHandler<AddCharacterData, string>(
function(userId: string, data: AddCharacterData, lang: 'fr' | 'en'): string {
return Character.addNewCharacter(userId, data.character, data.bookId, lang);
return Character.addNewCharacter(userId, data.character, data.bookId, lang, data.id);
}
)
);
@@ -47,7 +49,7 @@ ipcMain.handle('db:character:create', createHandler<AddCharacterData, string>(
// POST /character/attribute/add - Add attribute to character
ipcMain.handle('db:character:attribute:add', createHandler<AddAttributeData, string>(
function(userId: string, data: AddAttributeData, lang: 'fr' | 'en'): string {
return Character.addNewAttribute(data.characterId, userId, data.type, data.name, lang);
return Character.addNewAttribute(data.characterId, userId, data.type, data.name, lang, data.id);
}
)
);