init
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import { DEFINE_STRING } from '../../ipcDefineString'
|
||||
import { ipcMain } from 'electron'
|
||||
import { presetHandle } from '@/main/service/preset'
|
||||
import { PresetModel } from '@/define/model/preset'
|
||||
|
||||
function PresetIpc() {
|
||||
/** 通过条件获取预设 */
|
||||
ipcMain.handle(
|
||||
DEFINE_STRING.PRESET.GET_PRESET_BY_CONDITION,
|
||||
async (_, queryCondition: PresetModel.Preset) =>
|
||||
await presetHandle.GetPresetByCondition(queryCondition)
|
||||
)
|
||||
|
||||
/** 通过ID获取预设 */
|
||||
ipcMain.handle(
|
||||
DEFINE_STRING.PRESET.GET_PRESET_BY_ID,
|
||||
async (_, id: string) => await presetHandle.GetPresetById(id)
|
||||
)
|
||||
|
||||
/** 添加预设 */
|
||||
ipcMain.handle(
|
||||
DEFINE_STRING.PRESET.ADD_PRESET,
|
||||
async (_, preset: PresetModel.Preset) => await presetHandle.AddPreset(preset)
|
||||
)
|
||||
|
||||
/** 修改预设 */
|
||||
ipcMain.handle(
|
||||
DEFINE_STRING.PRESET.MODIFY_PRESET,
|
||||
async (_, id: string, preset: Partial<PresetModel.Preset>) =>
|
||||
await presetHandle.ModifyPreset(id, preset)
|
||||
)
|
||||
|
||||
/** 删除预设 */
|
||||
ipcMain.handle(
|
||||
DEFINE_STRING.PRESET.DELETE_PRESET,
|
||||
async (_, id: string) => await presetHandle.DeletePreset(id)
|
||||
)
|
||||
}
|
||||
|
||||
export default PresetIpc
|
||||
Reference in New Issue
Block a user