Update database schema and synchronization logic

- Add `useEffect` in `ScribeLeftBar` for handling book state changes.
- Extend `BooksSyncContext` with new properties and stricter typings.
- Refine `Repositories` to include `lastUpdate` handling for synchronization processes.
- Add comprehensive `fetchComplete*` repository methods for retrieving entity-specific sync data.
- Enhance offline logic for chapters, characters, locations, and world synchronization.
- Improve error handling across IPC handlers and repositories.
This commit is contained in:
natreex
2025-12-15 20:55:24 -05:00
parent bb331b5c22
commit 64c7cb6243
23 changed files with 1609 additions and 79 deletions

View File

@@ -1,13 +1,15 @@
import {SyncedBook} from "@/lib/models/SyncedBook";
import {Context, createContext} from "react";
import {BookSyncCompare, SyncedBook} from "@/lib/models/SyncedBook";
import {Context, createContext, Dispatch, SetStateAction} from "react";
export type SyncType = 'server-only' | 'local-only' | 'to-sync-from-server' | 'to-sync-to-server' | 'synced'
export interface BooksSyncContextProps {
serverSyncedBooks:SyncedBook[];
localSyncedBooks:SyncedBook[];
booksToSyncFromServer:SyncedBook[];
booksToSyncToServer:SyncedBook[];
booksToSyncFromServer:BookSyncCompare[];
booksToSyncToServer:BookSyncCompare[];
setServerOnlyBooks:Dispatch<SetStateAction<SyncedBook[]>>;
setLocalOnlyBooks:Dispatch<SetStateAction<SyncedBook[]>>;
serverOnlyBooks:SyncedBook[];
localOnlyBooks:SyncedBook[];
}
@@ -17,6 +19,8 @@ export const BooksSyncContext:Context<BooksSyncContextProps> = createContext<Boo
localSyncedBooks:[],
booksToSyncFromServer:[],
booksToSyncToServer:[],
setServerOnlyBooks:():void => {},
setLocalOnlyBooks:():void => {},
serverOnlyBooks:[],
localOnlyBooks:[]
})