be able to unfix a boat damage for tech
This commit is contained in:
@@ -152,6 +152,25 @@ pub struct FormBoatDamageVerified<'r> {
|
||||
desc: &'r str,
|
||||
}
|
||||
|
||||
#[post("/<boatdamage_id>/unfix")]
|
||||
async fn unfix(
|
||||
db: &State<SqlitePool>,
|
||||
boatdamage_id: i32,
|
||||
techuser: TechUser,
|
||||
) -> Flash<Redirect> {
|
||||
let Some(boatdamage) = BoatDamage::find_by_id(db, boatdamage_id).await else {
|
||||
return Flash::error(Redirect::to("/boatdamage"), "Bootsschaden nicht gefunden.");
|
||||
};
|
||||
let user: User = techuser.into_inner();
|
||||
match boatdamage.unfix(db, &user).await {
|
||||
Ok(_) => Flash::success(
|
||||
Redirect::to("/boatdamage"),
|
||||
"Reparatur wurde zurückgesetzt.",
|
||||
),
|
||||
Err(e) => Flash::error(Redirect::to("/boatdamage"), format!("Fehler: {e}")),
|
||||
}
|
||||
}
|
||||
|
||||
#[post("/<boatdamage_id>/verified", data = "<data>")]
|
||||
async fn verified<'r>(
|
||||
db: &State<SqlitePool>,
|
||||
@@ -176,6 +195,7 @@ pub fn routes() -> Vec<Route> {
|
||||
index_kiosk,
|
||||
create,
|
||||
fixed,
|
||||
unfix,
|
||||
verified,
|
||||
create_from_kiosk
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user