feature/insight-jobs #102

Merged
cameron merged 13 commits from feature/insight-jobs into master 2026-06-02 23:41:37 +00:00
Showing only changes of commit 39ad83f55b - Show all commits
+7 -4
View File
@@ -161,13 +161,13 @@ impl InsightDao for SqliteInsightDao {
)
.set(is_current.eq(false))
.execute(connection.deref_mut())
.map_err(|_| anyhow::anyhow!("Update is_current error"))?;
.map_err(|e| anyhow::anyhow!("Failed to flip is_current: {}", e))?;
// Insert the new insight as current
diesel::insert_into(photo_insights)
.values(&insight)
.execute(connection.deref_mut())
.map_err(|_| anyhow::anyhow!("Insert error"))?;
.map_err(|e| anyhow::anyhow!("Failed to insert insight: {}", e))?;
// Retrieve the inserted record (is_current = true)
photo_insights
@@ -175,9 +175,12 @@ impl InsightDao for SqliteInsightDao {
.filter(rel_path.eq(&insight.file_path))
.filter(is_current.eq(true))
.first::<PhotoInsight>(connection.deref_mut())
.map_err(|_| anyhow::anyhow!("Query error"))
.map_err(|e| anyhow::anyhow!("Failed to retrieve inserted insight: {}", e))
})
.map_err(|e| {
log::error!("store_insight failed: {}", e);
DbError::new(DbErrorKind::InsertError)
})
.map_err(|_| DbError::new(DbErrorKind::InsertError))
}
fn get_insight(