Add default servings to profile + choose servings when scheduling
This commit is contained in:
parent
d8641d4db6
commit
ae6da1a5ae
13 changed files with 70 additions and 34 deletions
|
|
@ -28,7 +28,7 @@ pub async fn create(
|
|||
}
|
||||
|
||||
#[debug_handler]
|
||||
pub async fn edit_recipe(
|
||||
pub async fn edit(
|
||||
State(connection): State<db::Connection>,
|
||||
Extension(user): Extension<Option<model::User>>,
|
||||
Extension(tr): Extension<translation::Tr>,
|
||||
|
|
|
|||
|
|
@ -655,6 +655,7 @@ pub async fn edit_user_get(
|
|||
ProfileTemplate {
|
||||
username: &user.name,
|
||||
email: &user.email,
|
||||
default_servings: user.default_servings,
|
||||
message: "",
|
||||
message_email: "",
|
||||
message_password: "",
|
||||
|
|
@ -673,6 +674,7 @@ pub async fn edit_user_get(
|
|||
pub struct EditUserForm {
|
||||
name: String,
|
||||
email: String,
|
||||
default_servings: u32,
|
||||
password_1: String,
|
||||
password_2: String,
|
||||
}
|
||||
|
|
@ -712,6 +714,7 @@ pub async fn edit_user_post(
|
|||
user: Some(user),
|
||||
username: &form_data.name,
|
||||
email: &form_data.email,
|
||||
default_servings: form_data.default_servings,
|
||||
message_email: match error {
|
||||
ProfileUpdateError::InvalidEmail => tr.t(Sentence::InvalidEmail),
|
||||
ProfileUpdateError::EmailAlreadyTaken => tr.t(Sentence::EmailAlreadyTaken),
|
||||
|
|
@ -760,6 +763,7 @@ pub async fn edit_user_post(
|
|||
user.id,
|
||||
Some(email_trimmed),
|
||||
Some(&form_data.name),
|
||||
Some(form_data.default_servings),
|
||||
new_password,
|
||||
)
|
||||
.await
|
||||
|
|
@ -815,6 +819,7 @@ pub async fn edit_user_post(
|
|||
user,
|
||||
username: &form_data.name,
|
||||
email: &form_data.email,
|
||||
default_servings: form_data.default_servings,
|
||||
message,
|
||||
message_email: "",
|
||||
message_password: "",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue