start with activity + fix tests
All checks were successful
CI/CD Pipeline / test (push) Successful in 15m51s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Has been skipped

This commit is contained in:
2025-05-03 19:04:13 +02:00
parent d50501b362
commit e360c4f06b
8 changed files with 121 additions and 36 deletions

View File

@ -327,6 +327,34 @@ async fn update_mail(
}
}
#[derive(FromForm, Debug)]
pub struct AddNoteForm {
note: String,
}
#[post("/user/<id>/add-note", data = "<data>")]
async fn add_note(
db: &State<SqlitePool>,
data: Form<AddNoteForm>,
admin: ManageUserUser,
id: i32,
) -> Flash<Redirect> {
let Some(user) = User::find_by_id(db, id).await else {
return Flash::error(
Redirect::to("/admin/user"),
format!("User with ID {} does not exist!", id),
);
};
match user.add_note(db, &admin, &data.note).await {
Ok(_) => Flash::success(
Redirect::to(format!("/admin/user/{}", user.id)),
"Notiz hinzugefügt",
),
Err(e) => Flash::error(Redirect::to(format!("/admin/user/{}", user.id)), e),
}
}
#[derive(FromForm, Debug)]
pub struct PhoneUpdateForm {
phone: String,
@ -1147,6 +1175,7 @@ pub fn routes() -> Vec<Route> {
update_family,
add_membership_pdf,
add_role,
add_note,
remove_role,
//
scheckbook_to_regular,