Refactor IPC handlers, types, and models for streamlined data handling
- Unified return types across IPC handlers (`Character`, `Location`, `World`, and `Book`) for consistency. - Replaced `BookListProps` with `BookProps` for simplified type usage in components and handlers. - Cleaned up obsolete `BookListProps` interface and applied consistent typings throughout. - Updated imports to include revised response types (`CharacterListResponse`, `LocationListResponse`, `WorldListResponse`). - Adjusted data transformation logic in `BookList` and related components to align with new type definitions.
This commit is contained in:
@@ -12,7 +12,7 @@ import Upload from "../database/models/Upload.js";
|
||||
import GuideLine, {GuideLineAI} from "../database/models/GuideLine.js";
|
||||
import Incident from "../database/models/Incident.js";
|
||||
import PlotPoint from "../database/models/PlotPoint.js";
|
||||
import World, {WorldProps} from "../database/models/World.js";
|
||||
import World, {WorldListResponse, WorldProps} from "../database/models/World.js";
|
||||
|
||||
interface UpdateBookBasicData {
|
||||
title: string;
|
||||
@@ -330,8 +330,8 @@ ipcMain.handle('db:book:issue:remove', createHandler<RemoveIssueData, boolean>(
|
||||
interface GetWorldsData {
|
||||
bookid: string;
|
||||
}
|
||||
ipcMain.handle('db:book:worlds:get', createHandler<GetWorldsData, WorldProps[]>(
|
||||
function(userId: string, data: GetWorldsData, lang: 'fr' | 'en') {
|
||||
ipcMain.handle('db:book:worlds:get', createHandler<GetWorldsData, WorldListResponse>(
|
||||
function(userId: string, data: GetWorldsData, lang: 'fr' | 'en'): WorldListResponse {
|
||||
return World.getWorlds(userId, data.bookid, lang);
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user