- npm workspaces 루트 (apps/*, packages/*) 세팅 - V1 전체를 apps/desktop/으로 git mv (src, resources, tests, sidecar, scripts, electron.vite.config.ts, electron-builder.yml, vitest.config.ts, tsconfig.node.json, tsconfig.web.json) - apps/desktop/package.json 신규 (name=@d3ro/desktop) - productName: 'd3ro-voice' 명시 — app.getName()을 고정하여 userData 경로 %APPDATA%\d3ro-voice\ 그대로 유지 (기존 DB/설정 연속성 보장) - 루트 package.json을 workspace 루트로 재구성, 공통 devDep만 유지 (typescript, eslint, prettier) - turbo.json, tsconfig.base.json 추가 (Turborepo 자체 설치는 별도 sub-phase) - memory/project_status.md 생성 (규칙 13) 검증: - npm run typecheck 통과 - npm run build 통과 (electron-vite main+preload+renderer) - npm run dev 실제 실행 → DB/핫키/Ollama 자동 실행 모두 정상
74 lines
2.5 KiB
TypeScript
74 lines
2.5 KiB
TypeScript
// src/main/ipc/memo-handlers.ts
|
|
// Phase 10.3: 음성 메모 태그 IPC 핸들러
|
|
|
|
import { ipcMain } from 'electron'
|
|
import { IPC_CHANNELS } from '@shared/ipc-channels'
|
|
import { ipcSuccess, ipcError, ErrorCode, D3ROError } from '@shared/errors'
|
|
import { getMemoService } from '../services/MemoService'
|
|
import type {
|
|
GetTagsParams,
|
|
AddTagParams,
|
|
RemoveTagParams,
|
|
SearchByTagParams,
|
|
ExportMemoParams
|
|
} from '@shared/types'
|
|
|
|
export function registerMemoHandlers(): void {
|
|
ipcMain.handle(IPC_CHANNELS.MEMO.GET_TAGS, async (_event, params: GetTagsParams) => {
|
|
try {
|
|
return ipcSuccess(getMemoService().getTagsForEntry(params.historyId))
|
|
} catch {
|
|
return ipcError(ErrorCode.DBQueryFailed, 'Failed to get tags for history entry')
|
|
}
|
|
})
|
|
|
|
ipcMain.handle(IPC_CHANNELS.MEMO.ADD_TAG, async (_event, params: AddTagParams) => {
|
|
try {
|
|
return ipcSuccess(getMemoService().addTag(params.historyId, params.tag))
|
|
} catch (err) {
|
|
if (err instanceof D3ROError && err.code === ErrorCode.MemoTagDuplicate) {
|
|
return ipcError(ErrorCode.MemoTagDuplicate, err.message)
|
|
}
|
|
return ipcError(ErrorCode.DBWriteFailed, 'Failed to add tag')
|
|
}
|
|
})
|
|
|
|
ipcMain.handle(IPC_CHANNELS.MEMO.REMOVE_TAG, async (_event, params: RemoveTagParams) => {
|
|
try {
|
|
getMemoService().removeTag(params.historyId, params.tag)
|
|
return ipcSuccess(undefined)
|
|
} catch (err) {
|
|
if (err instanceof D3ROError && err.code === ErrorCode.MemoTagNotFound) {
|
|
return ipcError(ErrorCode.MemoTagNotFound, err.message)
|
|
}
|
|
return ipcError(ErrorCode.DBWriteFailed, 'Failed to remove tag')
|
|
}
|
|
})
|
|
|
|
ipcMain.handle(IPC_CHANNELS.MEMO.GET_ALL_TAGS, async () => {
|
|
try {
|
|
return ipcSuccess(getMemoService().getAllTags())
|
|
} catch {
|
|
return ipcError(ErrorCode.DBQueryFailed, 'Failed to get all tags')
|
|
}
|
|
})
|
|
|
|
ipcMain.handle(IPC_CHANNELS.MEMO.SEARCH_BY_TAG, async (_event, params: SearchByTagParams) => {
|
|
try {
|
|
return ipcSuccess(getMemoService().searchByTag(params))
|
|
} catch {
|
|
return ipcError(ErrorCode.DBQueryFailed, 'Failed to search by tag')
|
|
}
|
|
})
|
|
|
|
ipcMain.handle(IPC_CHANNELS.MEMO.EXPORT, async (_event, params: ExportMemoParams) => {
|
|
try {
|
|
return ipcSuccess(getMemoService().exportMarkdown(params))
|
|
} catch (err) {
|
|
if (err instanceof D3ROError && err.code === ErrorCode.MemoExportFailed) {
|
|
return ipcError(ErrorCode.MemoExportFailed, err.message)
|
|
}
|
|
return ipcError(ErrorCode.MemoExportFailed, 'Failed to export memo')
|
|
}
|
|
})
|
|
}
|