feat: db backed record removal

This commit is contained in:
Zynh Ludwig 2024-11-21 07:07:15 -08:00
parent 7db8ac69c9
commit 51b5b5cd3b
2 changed files with 11 additions and 0 deletions

View file

@ -0,0 +1,2 @@
DELETE FROM records
WHERE cache_name = ?;

View file

@ -48,6 +48,15 @@ async fn link_delete(
.await
.map_err(|err| (StatusCode::INTERNAL_SERVER_ERROR, err.to_string()))?;
{
let mut conn = state.pool.acquire().await.unwrap();
sqlx::query_file!("queries/records/remove_record.sql", id)
.execute(&mut *conn)
.await
.map_err(|err| (StatusCode::INTERNAL_SERVER_ERROR, err.to_string()))?;
}
Ok(Html("".to_string()))
}