mirror of
https://github.com/eliasrenman/url-shortener.git
synced 2026-03-16 20:16:06 +01:00
feat: conditional delete
This commit is contained in:
@@ -34,7 +34,7 @@ pub fn upsert_entry(
|
||||
.execute(connection)
|
||||
}
|
||||
|
||||
pub fn delete_entry(path: &str) -> Result<usize, Error> {
|
||||
pub fn delete_entry(id: &str, path: &str) -> Result<usize, Error> {
|
||||
let connection = &mut establish_connection();
|
||||
delete(urls.filter(url.eq(path))).execute(connection)
|
||||
delete(urls.filter(url.eq(path)).filter(owned_by.eq(id))).execute(connection)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user