summaryrefslogtreecommitdiff
path: root/src/message/routes/message.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/message/routes/message.rs')
-rw-r--r--src/message/routes/message.rs43
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(),
- }
- }
- }
-}