Add first day of the week feature to user settings and calendar functionality

This commit is contained in:
Greg Burri 2025-04-19 12:01:46 +02:00
parent 39f5b968b4
commit fdbf2e4f27
15 changed files with 191 additions and 42 deletions

View file

@ -141,7 +141,11 @@ pub async fn sign_up_post(
}
match connection
.sign_up(&form_data.email, &form_data.password_1)
.sign_up(
&form_data.email,
&form_data.password_1,
context.tr.first_day_of_week(),
)
.await
{
Ok(db::user::SignUpResult::UserAlreadyExists) => {
@ -691,6 +695,7 @@ pub struct EditUserForm {
name: String,
email: String,
default_servings: u32,
first_day_of_the_week: chrono::Weekday,
password_1: String,
password_2: String,
}
@ -713,6 +718,11 @@ pub async fn edit_user_post(
Extension(context): Extension<Context>,
Form(form_data): Form<EditUserForm>,
) -> Result<Response> {
event!(
Level::DEBUG,
"First day of the week: {:?}",
form_data.first_day_of_the_week
);
if let Some(ref user) = context.user {
fn error_response(
error: ProfileUpdateError,
@ -783,6 +793,7 @@ pub async fn edit_user_post(
Some(email_trimmed),
Some(&form_data.name),
Some(form_data.default_servings),
Some(form_data.first_day_of_the_week),
new_password,
)
.await