+// use actix_web::{
+// http::{header, header::ContentType, StatusCode},
+// post, put, web, HttpMessage, HttpRequest, HttpResponse, Responder,
+// };
+// use log::{debug, error, info, log_enabled, Level};
+// use ron::de::from_bytes;
+
+// use super::Result;
+// use crate::data::db;
+
+// #[put("/ron-api/recipe/set-title")]
+// pub async fn set_recipe_title(
+// req: HttpRequest,
+// body: web::Bytes,
+// connection: web::Data<db::Connection>,
+// ) -> Result<HttpResponse> {
+// let ron_req: common::ron_api::SetRecipeTitle = from_bytes(&body)?;
+// connection
+// .set_recipe_title_async(ron_req.recipe_id, &ron_req.title)
+// .await?;
+// Ok(HttpResponse::Ok().finish())
+// }
+
+// #[put("/ron-api/recipe/set-description")]
+// pub async fn set_recipe_description(
+// req: HttpRequest,
+// body: web::Bytes,
+// connection: web::Data<db::Connection>,
+// ) -> Result<HttpResponse> {
+// let ron_req: common::ron_api::SetRecipeDescription = from_bytes(&body)?;
+// connection
+// .set_recipe_description_async(ron_req.recipe_id, &ron_req.description)
+// .await?;
+// Ok(HttpResponse::Ok().finish())
+// }
+
+// #[put("/ron-api/recipe/add-image)]
+// #[put("/ron-api/recipe/rm-photo")]
+// #[put("/ron-api/recipe/add-ingredient")]
+// #[put("/ron-api/recipe/rm-ingredient")]
+// #[put("/ron-api/recipe/set-ingredients-order")]
+// #[put("/ron-api/recipe/add-group")]
+// #[put("/ron-api/recipe/rm-group")]
+// #[put("/ron-api/recipe/set-groups-order")]
+// #[put("/ron-api/recipe/add-step")]
+// #[put("/ron-api/recipe/rm-step")]
+// #[put("/ron-api/recipe/set-steps-order")]
+
+use askama_axum::IntoResponse;
+use axum::{
+ debug_handler,
+ extract::{Extension, State},
+ http::StatusCode,
+ response::ErrorResponse,
+ response::Result,
+};
+use tracing::{event, Level};
+
+use crate::{
+ data::db,
+ model,
+ ron_extractor::{ron_error, ron_response, ExtractRon},
+};
+
+#[debug_handler]
+pub async fn update_user(
+ State(connection): State<db::Connection>,
+ Extension(user): Extension<Option<model::User>>,
+ ExtractRon(ron): ExtractRon<common::ron_api::UpdateProfile>,
+) -> Result<StatusCode> {
+ if let Some(user) = user {
+ // connection.set_user_name(user.id, &ron.name).await?;
+ } else {
+ return Err(ErrorResponse::from(ron_error(
+ StatusCode::UNAUTHORIZED,
+ "Action not authorized",
+ )));
+ }
+ Ok(StatusCode::OK)
+}
+
+/* Example with RON return value.
+#[debug_handler]
+pub async fn set_user_name(
+ State(connection): State<db::Connection>,
+ Extension(user): Extension<Option<model::User>>,
+ ExtractRon(ron): ExtractRon<common::ron_api::SetProfileName>,
+) -> Result<impl IntoResponse> {
+
+
+ Ok(ron_response(common::ron_api::SetProfileName {
+ name: "abc".to_string(),
+ }))
+}
+*/