feat: delete no longer touches records
This commit is contained in:
parent
72210b211e
commit
a817502793
1 changed files with 6 additions and 11 deletions
|
@ -46,21 +46,16 @@ async fn link(
|
||||||
|
|
||||||
async fn link_delete(
|
async fn link_delete(
|
||||||
axum::extract::Path(id): axum::extract::Path<String>,
|
axum::extract::Path(id): axum::extract::Path<String>,
|
||||||
State(mut state): State<AppState>,
|
State(state): State<AppState>,
|
||||||
) -> Result<Html<String>, (StatusCode, String)> {
|
) -> Result<Html<String>, (StatusCode, String)> {
|
||||||
state
|
let mut conn = state.pool.acquire().await.unwrap();
|
||||||
.remove_record(&id)
|
|
||||||
|
sqlx::query_file!("queries/records/remove_record.sql", id)
|
||||||
|
.execute(&mut *conn)
|
||||||
.await
|
.await
|
||||||
.map_err(|err| (StatusCode::INTERNAL_SERVER_ERROR, err.to_string()))?;
|
.map_err(|err| (StatusCode::INTERNAL_SERVER_ERROR, err.to_string()))?;
|
||||||
|
|
||||||
{
|
drop(conn);
|
||||||
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()))
|
Ok(Html("".to_string()))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue