Enhance synchronization logic and offline handling

- Refactor components to support conditional offline and online CRUD operations.
- Introduce `addToQueue` mechanism for syncing offline changes to the server.
- Add `isChapterContentExist` method and related existence checks in repositories.
- Consolidate data structures and streamline book, chapter, character, and guideline synchronization workflows.
- Encrypt additional character fields and adjust repository inserts for offline data.
This commit is contained in:
natreex
2026-01-07 20:43:34 -05:00
parent fa05d6dbae
commit 8eab6fd771
21 changed files with 557 additions and 578 deletions

View File

@@ -138,19 +138,11 @@ export default function AddNewBookForm({setCloseForm}: { setCloseForm: Dispatch<
};
let bookId: string;
if (!isCurrentlyOffline()) {
// Online - call API server
bookId = await System.authPostToServer<string>('book/add', {
title: title,
subTitle: subtitle,
type: selectedBookType,
summary: summary,
serie: 0,
publicationDate: publicationDate,
desiredWordCount: wordCount,
}, token, lang);
} else {
if (isCurrentlyOffline()) {
bookId = await window.electron.invoke<string>('db:book:create', bookData);
} else {
// Online - call API server
bookId = await System.authPostToServer<string>('book/add', bookData, token, lang);
}
if (!bookId) {