add ergo tool

This commit is contained in:
2023-11-02 12:15:10 +01:00
parent 2eba6a0f66
commit 1ff050a247
12 changed files with 486 additions and 95 deletions

View File

@ -58,12 +58,15 @@ async fn delete(db: &State<SqlitePool>, _admin: AdminUser, user: i32) -> Flash<R
}
#[derive(FromForm)]
struct UserEditForm {
id: i32,
is_guest: bool,
is_cox: bool,
is_admin: bool,
is_tech: bool,
pub struct UserEditForm {
pub(crate) id: i32,
pub(crate) is_guest: bool,
pub(crate) is_cox: bool,
pub(crate) is_admin: bool,
pub(crate) is_tech: bool,
pub(crate) dob: Option<String>,
pub(crate) weight: Option<String>,
pub(crate) sex: Option<String>,
}
#[post("/user", data = "<data>")]
@ -80,8 +83,7 @@ async fn update(
);
};
user.update(db, data.is_cox, data.is_admin, data.is_guest, data.is_tech)
.await;
user.update(db, data.into_inner()).await;
Flash::success(Redirect::to("/admin/user"), "Successfully updated user")
}