Phase 5 구현: SQLite DB + History/Dictionary 서비스 + UI

- DB: better-sqlite3 + drizzle-orm (history/dictionary/stats, WAL 모드)
- HistoryService: CRUD + 검색 + 통계 + 30일 보존 정책, 세션 완료 시 자동 저장
- DictionaryService: CRUD + 검색 + 사용 횟수 추적 + STT 프롬프트 힌트
- HistoryPage: 목록 + 검색 + 삭제 + 복사 + 페이지네이션
- DictionaryPage: 목록 + 검색 + 추가 다이얼로그 + 삭제
- DashboardPage: 실데이터 통계 (총/오늘 세션, 시간, 단어수, 연속일수)
- IPC: history/dictionary/stats 핸들러 + preload API
- Bootstrap: DB 초기화 (critical) + 이력 자동 저장 연동
This commit is contained in:
Yun Chan 2026-04-05 02:32:53 +09:00
parent 4a5cf6c819
commit 291e2a29d0
17 changed files with 3111 additions and 35 deletions

View file

@ -47,6 +47,20 @@ import type {
SetServerUrlParams,
LLMStatusChangedEvent,
LLMProcessProgressEvent,
HistoryQueryParams,
HistoryPage,
HistoryGetByIdParams,
HistoryEntry,
HistoryDeleteParams,
HistorySearchParams,
DictionaryQueryParams,
DictionaryPage,
DictionaryEntry,
DictionaryAddParams,
DictionaryUpdateParams,
DictionaryDeleteParams,
DictionarySearchParams,
StatsSummary,
PermissionStatus
} from '@shared/types'
import type { IPCResult } from '@shared/errors'
@ -169,6 +183,40 @@ const electronAPI = {
on(IPC_CHANNELS.LLM.PROCESS_PROGRESS, cb)
},
// ── History ────────────────────────────────────────────
history: {
getAll: (params: HistoryQueryParams) =>
invoke<HistoryPage>(IPC_CHANNELS.HISTORY.GET_ALL, params),
getById: (params: HistoryGetByIdParams) =>
invoke<HistoryEntry | null>(IPC_CHANNELS.HISTORY.GET_BY_ID, params),
delete: (params: HistoryDeleteParams) =>
invoke<void>(IPC_CHANNELS.HISTORY.DELETE, params),
deleteAll: () => invoke<void>(IPC_CHANNELS.HISTORY.DELETE_ALL),
search: (params: HistorySearchParams) =>
invoke<HistoryPage>(IPC_CHANNELS.HISTORY.SEARCH, params),
onAdded: (cb: (e: HistoryEntry) => void): Unsubscribe =>
on(IPC_CHANNELS.HISTORY.ADDED, cb)
},
// ── Dictionary ─────────────────────────────────────────
dictionary: {
getAll: (params: DictionaryQueryParams) =>
invoke<DictionaryPage>(IPC_CHANNELS.DICTIONARY.GET_ALL, params),
add: (params: DictionaryAddParams) =>
invoke<DictionaryEntry>(IPC_CHANNELS.DICTIONARY.ADD, params),
update: (params: DictionaryUpdateParams) =>
invoke<DictionaryEntry>(IPC_CHANNELS.DICTIONARY.UPDATE, params),
delete: (params: DictionaryDeleteParams) =>
invoke<void>(IPC_CHANNELS.DICTIONARY.DELETE, params),
search: (params: DictionarySearchParams) =>
invoke<DictionaryPage>(IPC_CHANNELS.DICTIONARY.SEARCH, params)
},
// ── Stats ──────────────────────────────────────────────
stats: {
getSummary: () => invoke<StatsSummary>(IPC_CHANNELS.STATS.GET_SUMMARY)
},
// ── Window ─────────────────────────────────────────────
window: {
minimize: () => send(IPC_CHANNELS.WINDOW.MINIMIZE),