feat: delete no longer touches records

This commit is contained in:
Zynh Ludwig 2024-11-21 15:30:08 -08:00
parent 72210b211e
commit a817502793

View file

@ -46,21 +46,16 @@ async fn link(
async fn link_delete(
axum::extract::Path(id): axum::extract::Path<String>,
State(mut state): State<AppState>,
State(state): State<AppState>,
) -> Result<Html<String>, (StatusCode, String)> {
state
.remove_record(&id)
.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()))?;
}
drop(conn);
Ok(Html("".to_string()))
}