diff --git a/queries/records/remove_record.sql b/queries/records/remove_record.sql new file mode 100644 index 0000000..979ff43 --- /dev/null +++ b/queries/records/remove_record.sql @@ -0,0 +1,2 @@ +DELETE FROM records +WHERE cache_name = ?; diff --git a/src/router/link.rs b/src/router/link.rs index bfa6511..3867e28 100644 --- a/src/router/link.rs +++ b/src/router/link.rs @@ -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())) }