This commit is contained in:
philipp 2023-11-02 12:25:13 +01:00
parent dc3e5555df
commit e1a7bdae65
4 changed files with 22 additions and 11 deletions

Binary file not shown.

View File

@ -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;

View File

@ -389,7 +389,7 @@ ORDER BY departure DESC
.await
.unwrap()
.id
.unwrap()
.unwrap() as i32
}
pub async fn home(

View File

@ -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);