Merge branch 'main' into notification-badge
All checks were successful
CI/CD Pipeline / test (push) Successful in 13m1s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Has been skipped

This commit is contained in:
2024-04-17 14:10:14 +02:00
5 changed files with 23 additions and 16 deletions

View File

@ -1,6 +1,7 @@
use crate::model::{
boat::{Boat, BoatToAdd, BoatToUpdate},
location::Location,
log::Log,
user::{AdminUser, User, UserWithRolesAndNotificationCount},
};
use rocket::{
@ -39,8 +40,10 @@ async fn index(
}
#[get("/boat/<boat>/delete")]
async fn delete(db: &State<SqlitePool>, _admin: AdminUser, boat: i32) -> Flash<Redirect> {
async fn delete(db: &State<SqlitePool>, admin: AdminUser, boat: i32) -> Flash<Redirect> {
let boat = Boat::find_by_id(db, boat).await;
Log::create(db, format!("{} deleted boat: {boat:?}", admin.user.name)).await;
match boat {
Some(boat) => {
boat.delete(db).await;