From eb40fab2c1df7867bcc25f4b5d5f141b258f2654 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Sun, 16 Oct 2022 18:32:55 +0200 Subject: Remove warnings --- src/models/warning.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/models/warning.rs') diff --git a/src/models/warning.rs b/src/models/warning.rs index 59fb99e..c420dd0 100644 --- a/src/models/warning.rs +++ b/src/models/warning.rs @@ -93,6 +93,22 @@ impl Warning { } } + /// Delete a report + pub async fn delete(warning_id: i32) -> Result<(), AppError> { + let pool = unsafe { get_client() }; + + sqlx::query( + r#" + DELETE FROM warnings WHERE id = $1 + "#, + ) + .bind(warning_id) + .execute(pool) + .await?; + + Ok(()) + } + /// List all warnings. A staffer can see all the warnings, a user cannot pub async fn list(page: i64, user_id: Option) -> Result, AppError> { let pool = unsafe { get_client() }; -- cgit v1.2.3-71-g8e6c