diff --git a/db.sqlite.bkp b/db.sqlite.bkp deleted file mode 100644 index 0ff20bc..0000000 Binary files a/db.sqlite.bkp and /dev/null differ diff --git a/migration.sql b/migration.sql index ca208ad..671a644 100644 --- a/migration.sql +++ b/migration.sql @@ -7,7 +7,12 @@ CREATE TABLE IF NOT EXISTS "user" ( "is_guest" boolean NOT NULL DEFAULT TRUE, "is_tech" boolean NOT NULL DEFAULT FALSE, "deleted" boolean NOT NULL DEFAULT FALSE, - "last_access" DATETIME + "last_access" DATETIME, + "dob" text, + "weight" text, + "sex" text, + "dirty_thirty" text, + "dirty_dozen" text ); CREATE TABLE IF NOT EXISTS "trip_type" ( @@ -115,10 +120,3 @@ CREATE TABLE IF NOT EXISTS "boat_damage" ( "verified_at" datetime, "lock_boat" boolean not null default false -- if true: noone can use the boat ); - --- tmp ergo challenge stuff -ALTER TABLE user ADD COLUMN dob text; -ALTER TABLE user ADD COLUMN weight text; -ALTER TABLE user ADD COLUMN sex text; -ALTER TABLE user ADD COLUMN dirty_thirty text; -ALTER TABLE user ADD COLUMN dirty_dozen text; diff --git a/src/model/logbook.rs b/src/model/logbook.rs index 85e4007..f03f209 100644 --- a/src/model/logbook.rs +++ b/src/model/logbook.rs @@ -389,7 +389,7 @@ ORDER BY departure DESC .await .unwrap() .id - .unwrap() + .unwrap() as i32 } pub async fn home( diff --git a/src/model/user.rs b/src/model/user.rs index 1c1f1b8..90061c7 100644 --- a/src/model/user.rs +++ b/src/model/user.rs @@ -530,7 +530,7 @@ impl<'r> FromRequest<'r> for NonGuestUser { #[cfg(test)] mod test { - use crate::testdb; + use crate::{tera::admin::user::UserEditForm, testdb}; use super::User; use sqlx::SqlitePool; @@ -599,7 +599,20 @@ mod test { let pool = testdb!(); let user = User::find_by_id(&pool, 1).await.unwrap(); - user.update(&pool, false, false, false, false).await; + user.update( + &pool, + UserEditForm { + id: 1, + is_guest: false, + is_cox: false, + is_admin: false, + is_tech: false, + dob: None, + weight: None, + sex: None, + }, + ) + .await; let user = User::find_by_id(&pool, 1).await.unwrap(); assert_eq!(user.is_admin, false);