Add ipc/chapter.ipc.ts to handle chapter-related database interactions

- Introduce IPC handlers in `ipc/chapter.ipc.ts` for chapter CRUD, content management, and related operations.
- Register chapter IPC module in `main.ts` for application-wide access.
- Enhance type definitions for chapter functionalities, improving code consistency.
- Refactor `ipc/book.ipc.ts` to include new `UpdateStoryData` interface and additional story update handler.
This commit is contained in:
natreex
2025-11-18 22:42:18 -05:00
parent 361a1b0b7c
commit 75e5d71c74
3 changed files with 196 additions and 15 deletions

View File

@@ -9,6 +9,7 @@ import { getDatabaseService } from './database/database.service.js';
// Import IPC handlers
import './ipc/book.ipc.js';
import './ipc/user.ipc.js';
import './ipc/chapter.ipc.js';
// Fix pour __dirname en ES modules
const __filename = fileURLToPath(import.meta.url);
@@ -204,7 +205,7 @@ ipcMain.handle('db:user:sync', async (_event, data: SyncUserData): Promise<boole
data.lastName,
data.username,
data.email,
'', // Password not needed for local DB
'',
lang
);
console.log(`[DB] User ${data.userId} synced successfully`);
@@ -273,10 +274,6 @@ ipcMain.handle('db-initialize', (_event, userId: string, encryptionKey: string)
// and use the new createHandler() pattern with auto userId/lang injection
app.whenReady().then(() => {
console.log('App ready, isDev:', isDev);
console.log('resourcesPath:', process.resourcesPath);
console.log('isPackaged:', app.isPackaged);
// Enregistrer le protocole custom app:// pour servir les fichiers depuis out/
if (!isDev) {
const outPath = path.join(process.resourcesPath, 'app.asar.unpacked/out');