This commit is contained in:
fengchuanhn@gmail.com
2026-05-22 18:42:26 +08:00
parent 2abc2134a8
commit d3af2e1124
19 changed files with 1856 additions and 116 deletions

View File

@@ -58,8 +58,21 @@ impl AudioStore {
self.with_db(|db| db.list().map_err(|e| e.to_string())).await
}
pub async fn insert(&self, name: String, file_path: String) -> Result<GeneratedAudioRecord, String> {
self.with_db(move |db| db.insert(&name, &file_path).map_err(|e| e.to_string()))
pub async fn insert(
&self,
name: String,
file_path: String,
source_text: String,
) -> Result<GeneratedAudioRecord, String> {
self.with_db(move |db| {
db.insert(&name, &file_path, &source_text)
.map_err(|e| e.to_string())
})
.await
}
pub async fn update_name(&self, id: i64, name: String) -> Result<(), String> {
self.with_db(move |db| db.update_name(id, &name).map_err(|e| e.to_string()))
.await
}