Update and Migrate Diesel to 2.0

Almost have tag support working, still figuring out how to get photo
tags.
This commit is contained in:
Cameron Cordes
2023-03-18 14:43:41 -04:00
parent 40c79d13db
commit 68bfcbf85f
8 changed files with 1009 additions and 586 deletions

14
src/error.rs Normal file
View File

@@ -0,0 +1,14 @@
use actix_web::{error::InternalError, http::StatusCode};
pub trait IntoHttpError<T> {
fn into_http_internal_err(self) -> Result<T, actix_web::Error>;
}
impl<T> IntoHttpError<T> for Result<T, anyhow::Error> {
fn into_http_internal_err(self) -> Result<T, actix_web::Error> {
self.map_err(|e| {
log::error!("Map to err: {:?}", e);
InternalError::new(e, StatusCode::INTERNAL_SERVER_ERROR).into()
})
}
}