+ Adding /neighbor/remove route api code and db-lib code

This patch has not yet been tested but will be in the coming patches

Sumamary: we're just doing a regular delete on the neighbor's table based off
the url field
This commit is contained in:
shockrah
2021-05-12 14:07:38 -07:00
parent e94c720332
commit fbcf16b735
4 changed files with 22 additions and 0 deletions

View File

@@ -73,3 +73,10 @@ pub async fn update(p: &Pool, url: &str, new: Neighbor) -> SqlResult<()> {
conn.exec_drop(q, sqlparams).await?;
Ok(())
}
pub async fn remove(p: &Pool, url: &str) -> SqlResult<()> {
let mut conn = p.get_conn().await?;
let q = "DELETE FROM neighbors WHERE url = :url";
conn.exec_drop(q, params!{"url" => url}).await?;
Ok(())
}