rustfmt
This commit is contained in:
parent
cc2e5b6893
commit
3f8d940c14
2 changed files with 14 additions and 11 deletions
|
|
@ -13,9 +13,9 @@ use rand::distributions::{Alphanumeric, DistString};
|
|||
use rusqlite::{named_params, params, OptionalExtension, Params};
|
||||
|
||||
use crate::{
|
||||
consts,
|
||||
hash::{hash, verify_password},
|
||||
model,
|
||||
consts,
|
||||
};
|
||||
|
||||
const CURRENT_DB_VERSION: u32 = 1;
|
||||
|
|
|
|||
|
|
@ -15,9 +15,7 @@ use crate::{
|
|||
config::Config,
|
||||
consts,
|
||||
data::{asynchronous, db},
|
||||
email,
|
||||
model,
|
||||
utils,
|
||||
email, model, utils,
|
||||
};
|
||||
|
||||
mod api;
|
||||
|
|
@ -224,11 +222,13 @@ pub async fn edit_recipe(
|
|||
let (id,) = path.into_inner();
|
||||
let user = match get_current_user(&req, connection.clone()).await {
|
||||
Some(u) => u,
|
||||
None =>
|
||||
None => {
|
||||
return Ok(MessageTemplate {
|
||||
user: None,
|
||||
message: "Cannot edit a recipe without being logged in",
|
||||
}.to_response())
|
||||
}
|
||||
.to_response())
|
||||
}
|
||||
};
|
||||
|
||||
let recipe = connection.get_recipe_async(id).await?;
|
||||
|
|
@ -236,8 +236,9 @@ pub async fn edit_recipe(
|
|||
if recipe.user_id != user.id {
|
||||
return Ok(MessageTemplate {
|
||||
message: "Cannot edit a recipe you don't own",
|
||||
user: Some(user)
|
||||
}.to_response())
|
||||
user: Some(user),
|
||||
}
|
||||
.to_response());
|
||||
}
|
||||
|
||||
let recipes = connection.get_all_recipe_titles_async().await?;
|
||||
|
|
@ -259,11 +260,13 @@ pub async fn new_recipe(
|
|||
) -> Result<HttpResponse> {
|
||||
let user = match get_current_user(&req, connection.clone()).await {
|
||||
Some(u) => u,
|
||||
None =>
|
||||
None => {
|
||||
return Ok(MessageTemplate {
|
||||
message: "Cannot create a recipe without being logged in",
|
||||
user: None
|
||||
}.to_response())
|
||||
user: None,
|
||||
}
|
||||
.to_response())
|
||||
}
|
||||
};
|
||||
|
||||
let recipe_id = connection.create_recipe_async(user.id).await?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue