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
|
|
||||||
.remove_record(&id)
|
|
||||||
.await
|
|
||||||
.map_err(|err| (StatusCode::INTERNAL_SERVER_ERROR, err.to_string()))?;
|
|
||||||
|
|
||||||
{
|
|
||||||
let mut conn = state.pool.acquire().await.unwrap();
|
let mut conn = state.pool.acquire().await.unwrap();
|
||||||
|
|
||||||
sqlx::query_file!("queries/records/remove_record.sql", id)
|
sqlx::query_file!("queries/records/remove_record.sql", id)
|
||||||
.execute(&mut *conn)
|
.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);
|
||||||
|
|
||||||
Ok(Html("".to_string()))
|
Ok(Html("".to_string()))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue