diff options
| author | Owen Jacobson <owen@grimoire.ca> | 2024-10-23 12:00:30 -0400 |
|---|---|---|
| committer | Owen Jacobson <owen@grimoire.ca> | 2024-10-23 12:00:30 -0400 |
| commit | b614d0a754b3432dac1624410f37579712decc41 (patch) | |
| tree | 2bb22bd39098b70ffc600c0220c1ad88d68a211a /src/message/routes/message.rs | |
| parent | 08a2f47bcdd774a1e52ca77dc2377c8ca5f8a5f0 (diff) | |
Tests for `DELETE /api/messages/:id`
Diffstat (limited to 'src/message/routes/message.rs')
| -rw-r--r-- | src/message/routes/message.rs | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/src/message/routes/message.rs b/src/message/routes/message.rs deleted file mode 100644 index f83cb39..0000000 --- a/src/message/routes/message.rs +++ /dev/null @@ -1,43 +0,0 @@ -pub mod delete { - use axum::{ - extract::{Path, State}, - http::StatusCode, - response::{IntoResponse, Response}, - }; - - use crate::{ - app::App, - clock::RequestedAt, - error::{Internal, NotFound}, - message::{self, app::DeleteError}, - token::extract::Identity, - }; - - pub async fn handler( - State(app): State<App>, - Path(message): Path<message::Id>, - RequestedAt(deleted_at): RequestedAt, - _: Identity, - ) -> Result<StatusCode, Error> { - app.messages().delete(&message, &deleted_at).await?; - - Ok(StatusCode::ACCEPTED) - } - - #[derive(Debug, thiserror::Error)] - #[error(transparent)] - pub struct Error(#[from] pub DeleteError); - - impl IntoResponse for Error { - fn into_response(self) -> Response { - let Self(error) = self; - #[allow(clippy::match_wildcard_for_single_variants)] - match error { - DeleteError::NotFound(_) | DeleteError::Deleted(_) => { - NotFound(error).into_response() - } - other => Internal::from(other).into_response(), - } - } - } -} |
