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:
@@ -149,7 +149,7 @@ export default class Chapter {
|
||||
const response:string = await QS.request(prompt,'summary-chapter');
|
||||
console.log(response);
|
||||
}*/
|
||||
return ChapterRepo.updateChapterContent(userId, chapterId, version, encryptContent, wordsCount, lang);
|
||||
return ChapterRepo.updateChapterContent(userId, chapterId, version, encryptContent, wordsCount, System.timeStampInSeconds(), lang);
|
||||
}
|
||||
|
||||
public static getLastChapter(userId: string, bookId: string, lang: 'fr' | 'en' = 'fr'): ChapterProps | null {
|
||||
@@ -200,7 +200,7 @@ export default class Chapter {
|
||||
const hashedTitle: string = System.hashElement(title);
|
||||
const userKey: string = getUserEncryptionKey(userId);
|
||||
const encryptedTitle: string = System.encryptDataWithUserKey(title, userKey);
|
||||
return ChapterRepo.updateChapter(userId, chapterId, encryptedTitle, hashedTitle, chapterOrder, lang);
|
||||
return ChapterRepo.updateChapter(userId, chapterId, encryptedTitle, hashedTitle, chapterOrder, System.timeStampInSeconds(), lang);
|
||||
}
|
||||
|
||||
static updateChapterInfos(chapters: ActChapter[], userId: string, actId: number, bookId: string, incidentId: string | null, plotId: string | null, lang: 'fr' | 'en' = 'fr') {
|
||||
@@ -209,7 +209,7 @@ export default class Chapter {
|
||||
const summary: string = chapter.summary ? System.encryptDataWithUserKey(chapter.summary, userKey) : '';
|
||||
const goal: string = chapter.goal ? System.encryptDataWithUserKey(chapter.goal, userKey) : '';
|
||||
const chapterId: string = chapter.chapterId;
|
||||
ChapterRepo.updateChapterInfos(userId, chapterId, actId, bookId, incidentId, plotId, summary, goal, lang);
|
||||
ChapterRepo.updateChapterInfos(userId, chapterId, actId, bookId, incidentId, plotId, summary, goal, System.timeStampInSeconds(), lang);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user