diff options
| author | Santo Cariotti <santo@dcariotti.me> | 2022-10-16 16:32:55 +0000 |
|---|---|---|
| committer | Santo Cariotti <santo@dcariotti.me> | 2022-10-16 16:32:55 +0000 |
| commit | eb40fab2c1df7867bcc25f4b5d5f141b258f2654 (patch) | |
| tree | 1e0543e2009a871d71a38eb6808f814f5ee2e2fb /src/models/warning.rs | |
| parent | 9790a954fc9cc094c98faee1a8ce10f6adeec93d (diff) | |
Remove warnings
Diffstat (limited to 'src/models/warning.rs')
| -rw-r--r-- | src/models/warning.rs | 16 |
1 files changed, 16 insertions, 0 deletions
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<i32>) -> Result<Vec<WarningUser>, AppError> { let pool = unsafe { get_client() }; |
