chore(cleanup): drop legacy global dictionary Tauri commands — profile_terms is canonical
Task 16 of Phase 2 Remaining. Removes the three global-dictionary Tauri commands now that all frontend callers were migrated to the profile-scoped equivalents in Task 15: - list_dictionary_command - add_dictionary_entry_command - delete_dictionary_entry_command Also drops the DictionaryDto and its From<DictionaryEntry> impl (dead alongside the commands), plus the now-unused kon_storage imports (list_dictionary, add_dictionary_entry, delete_dictionary_entry, DictionaryEntry). The storage-layer functions and the dictionary table itself stay until Task 17 drops them. Codex verification point 5 cleared: zero frontend callers for the legacy commands (or their _cmd aliases) before deletion. cargo check -p kon: clean. cargo test --workspace: 40 passed; pre-existing ensure_x11_on_wayland doctest failure at src-tauri/src/lib.rs:77 unchanged.
This commit is contained in:
@@ -1,21 +1,24 @@
|
||||
// Tauri commands wrapping the kon_storage transcript and dictionary CRUD.
|
||||
// Tauri commands wrapping the kon_storage transcript CRUD.
|
||||
// These are the bridge that lets the Svelte frontend treat SQLite as the
|
||||
// canonical store rather than localStorage.
|
||||
//
|
||||
// Day 4 of the upgrade plan. The frontend HistoryPage rename flow has had
|
||||
// a `// TODO: persist to SQLite when update_transcript exists` for some
|
||||
// time; that command now exists.
|
||||
//
|
||||
// Task 16 — the legacy global-dictionary commands
|
||||
// (`list_dictionary_command`, `add_dictionary_entry_command`,
|
||||
// `delete_dictionary_entry_command`) were dropped; profile-scoped
|
||||
// `profile_terms` commands in `commands::profiles` are now canonical.
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use kon_storage::{
|
||||
add_dictionary_entry, count_transcripts, delete_dictionary_entry,
|
||||
delete_transcript as db_delete_transcript, get_transcript as db_get_transcript,
|
||||
insert_transcript as db_insert_transcript, list_dictionary,
|
||||
count_transcripts, delete_transcript as db_delete_transcript,
|
||||
get_transcript as db_get_transcript, insert_transcript as db_insert_transcript,
|
||||
list_transcripts_paged, search_transcripts as db_search_transcripts,
|
||||
update_transcript as db_update_transcript,
|
||||
update_transcript_meta as db_update_transcript_meta, DictionaryEntry, InsertTranscriptParams,
|
||||
TranscriptRow,
|
||||
update_transcript_meta as db_update_transcript_meta, InsertTranscriptParams, TranscriptRow,
|
||||
};
|
||||
|
||||
use crate::AppState;
|
||||
@@ -233,57 +236,3 @@ pub async fn update_transcript_meta_cmd(
|
||||
Ok(TranscriptDto::from(row))
|
||||
}
|
||||
|
||||
// --- Dictionary commands (custom vocabulary) ---
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct DictionaryDto {
|
||||
pub id: i64,
|
||||
pub term: String,
|
||||
pub note: Option<String>,
|
||||
}
|
||||
|
||||
impl From<DictionaryEntry> for DictionaryDto {
|
||||
fn from(e: DictionaryEntry) -> Self {
|
||||
Self {
|
||||
id: e.id,
|
||||
term: e.term,
|
||||
note: e.note,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn list_dictionary_command(
|
||||
state: tauri::State<'_, AppState>,
|
||||
) -> Result<Vec<DictionaryDto>, String> {
|
||||
list_dictionary(&state.db)
|
||||
.await
|
||||
.map(|rows| rows.into_iter().map(DictionaryDto::from).collect())
|
||||
.map_err(|e| e.to_string())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn add_dictionary_entry_command(
|
||||
state: tauri::State<'_, AppState>,
|
||||
term: String,
|
||||
note: Option<String>,
|
||||
) -> Result<i64, String> {
|
||||
let term = term.trim();
|
||||
if term.is_empty() {
|
||||
return Err("Dictionary term cannot be empty".into());
|
||||
}
|
||||
add_dictionary_entry(&state.db, term, note.as_deref())
|
||||
.await
|
||||
.map_err(|e| e.to_string())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn delete_dictionary_entry_command(
|
||||
state: tauri::State<'_, AppState>,
|
||||
id: i64,
|
||||
) -> Result<(), String> {
|
||||
delete_dictionary_entry(&state.db, id)
|
||||
.await
|
||||
.map_err(|e| e.to_string())
|
||||
}
|
||||
|
||||
@@ -283,9 +283,6 @@ pub fn run() {
|
||||
commands::transcripts::update_transcript_meta_cmd,
|
||||
commands::transcripts::delete_transcript,
|
||||
commands::transcripts::search_transcripts,
|
||||
commands::transcripts::list_dictionary_command,
|
||||
commands::transcripts::add_dictionary_entry_command,
|
||||
commands::transcripts::delete_dictionary_entry_command,
|
||||
// Diagnostics (panic + error capture, manual report bundle)
|
||||
commands::diagnostics::log_frontend_error,
|
||||
commands::diagnostics::list_recent_errors_command,
|
||||
|
||||
Reference in New Issue
Block a user