TidGi-Desktop/src/services/wikiGitWorkspace/interface.ts
lin onetwo 9a98c7bc47
Feat/move folder (#655)
* feat: move folder and restart wiki in workspace setting

* Update index.ts

* fix: review

* Update defaultWiki.feature

* Update defaultWiki.feature

* fix: clear test id

* Update wiki.ts
2025-11-21 14:04:45 +08:00

35 lines
1.7 KiB
TypeScript

import { WikiGitWorkspaceChannel } from '@/constants/channels';
import type { IGitUserInfos } from '@services/git/interface';
import type { INewWikiWorkspaceConfig, IWorkspace } from '@services/workspaces/interface';
import { ProxyPropertyType } from 'electron-ipc-cat/common';
/**
* Deal with operations that needs to create a wiki and a git repo at once in a workspace
*/
export interface IWikiGitWorkspaceService {
/** Create a new workspace, and call git.initWikiGit , and rollback (delete created wiki folder) if it failed */
initWikiGitTransaction(newWorkspaceConfig: INewWikiWorkspaceConfig, userInfo?: IGitUserInfos): Promise<IWorkspace | undefined>;
/** register this in main.ts if syncBeforeShutdown in preference is true
* If this is not an online sync wiki, there is no need to backup locally, because this feature is intended to sync between devices.
*/
registerSyncBeforeShutdown(): void;
removeWorkspace: (id: string) => Promise<void>;
/**
* Automatically initialize a default wiki workspace if none exists.
*/
initialize(): Promise<void>;
/**
* Move workspace to a new location. Will stop wiki worker before moving to prevent file lock issues.
* @param workspaceID The workspace to move
* @param newLocation The new parent folder path where the wiki folder will be moved
*/
moveWorkspaceLocation: (workspaceID: string, newLocation: string) => Promise<void>;
}
export const WikiGitWorkspaceServiceIPCDescriptor = {
channel: WikiGitWorkspaceChannel.name,
properties: {
initWikiGitTransaction: ProxyPropertyType.Function,
removeWorkspace: ProxyPropertyType.Function,
moveWorkspaceLocation: ProxyPropertyType.Function,
},
};