Introduce series management functionality and repository updates
- Added `series-world.repo.ts` to handle database operations related to series worlds and their elements. - Implemented `series-sync.repo.ts` for managing synchronization between books and series. - Expanded `spell.ipc.ts` data models to include `seriesSpellId` for spell synchronization. - Refactored `insertSpellTag` method in `spelltag.repo.ts` for improved error handling and logic clarity.
This commit is contained in:
24
electron/ipc/series-sync.ipc.ts
Normal file
24
electron/ipc/series-sync.ipc.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { ipcMain } from 'electron';
|
||||
import { createHandler } from '../database/LocalSystem.js';
|
||||
import SeriesSync, { SeriesSyncUploadPayload, SeriesSyncResult } from '../database/models/SeriesSync.js';
|
||||
import { SyncElementType } from '../database/repositories/series-sync.repo.js';
|
||||
|
||||
interface UploadToSeriesData {
|
||||
type: SyncElementType;
|
||||
bookElementId: string;
|
||||
field: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
// POST /series/sync/upload - Upload field to series
|
||||
ipcMain.handle('db:series:sync:upload', createHandler<UploadToSeriesData, SeriesSyncResult>(
|
||||
function(userId: string, data: UploadToSeriesData, lang: 'fr' | 'en'): SeriesSyncResult {
|
||||
const payload: SeriesSyncUploadPayload = {
|
||||
type: data.type,
|
||||
bookElementId: data.bookElementId,
|
||||
field: data.field,
|
||||
value: data.value || ''
|
||||
};
|
||||
return SeriesSync.uploadFieldToSeries(userId, payload, lang);
|
||||
}
|
||||
));
|
||||
Reference in New Issue
Block a user