use serde::Serialize; use crate::response::AppResponse; use actix_web::web::Json; use std::fmt::{Debug, Display}; pub type JsonAppResponse = Json>; impl From> for JsonAppResponse { fn from(data: AppResponse) -> Self { actix_web::web::Json(data) } } impl actix_web::error::ResponseError for AppResponse where T: Debug + Display + Clone + Serialize, { fn status_code(&self) -> actix_web::http::StatusCode { actix_web::http::StatusCode::OK } fn error_response(&self) -> actix_web::HttpResponse { actix_web::HttpResponse::Ok().json(self) } }