From 955598dce9aeb5626654c72b0ef94850123fa8ac Mon Sep 17 00:00:00 2001 From: Tolmachev Igor Date: Sun, 14 Sep 2025 23:27:25 +0300 Subject: Add openapi specs and docs --- src/response.rs | 54 ------------------------------------------------------ 1 file changed, 54 deletions(-) delete mode 100644 src/response.rs (limited to 'src/response.rs') diff --git a/src/response.rs b/src/response.rs deleted file mode 100644 index a633570..0000000 --- a/src/response.rs +++ /dev/null @@ -1,54 +0,0 @@ -use axum::{ - http::StatusCode, - response::{IntoResponse, Response}, -}; -use serde::Serialize; -use serde_json::json; - -pub struct SuccessResponse(pub T); -pub struct FailResponse(pub String, pub String); -pub struct ErrorResponse(pub String, pub String); - -impl IntoResponse for SuccessResponse -where - T: Serialize, -{ - fn into_response(self) -> Response { - ( - StatusCode::OK, - axum::Json(json!({ - "status": "success", - "data": self.0 - })), - ) - .into_response() - } -} - -impl IntoResponse for FailResponse { - fn into_response(self) -> Response { - ( - StatusCode::BAD_REQUEST, - axum::Json(json!({ - "status": "fail", - "kind": self.0, - "message": self.1 - })), - ) - .into_response() - } -} - -impl IntoResponse for ErrorResponse { - fn into_response(self) -> Response { - ( - StatusCode::INTERNAL_SERVER_ERROR, - axum::Json(json!({ - "status": "error", - "kind": self.0, - "message": self.1 - })), - ) - .into_response() - } -} -- cgit v1.2.3