diff --git a/README.md b/README.md index 876aea5..e04419d 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,5 @@ -# DB -- day - - day (e.g. 2023-02-07) UNIQUE - - planned\_amount\_coxes (e.g. 2) DEFAULT 0 - - planned\_starting\_time NULLABLE STRING - - open\_registration DEFAULT true (false e.g. when usi rowing) -- trip - - day (FK) - - user\_id - - cox\_id NULLABLE (used if person wants to go with specific cox) - - begin STRING NULLABLE (only used user\_id wants to to be a cox) - - created TIMESTAMP DEFAULT NOW -- user - - id - - name UNIQUE - - is\_cox DEFAULT false - - is\_admin DEFAULT false +# Next +- User edit view (for admins) # UI - Next 7 days as columns diff --git a/db.sqlite b/db.sqlite index d8a30b1..7e4d0e9 100644 Binary files a/db.sqlite and b/db.sqlite differ diff --git a/src/main.rs b/src/main.rs index 2a7721c..818f2c9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,6 +11,7 @@ use chrono::Local; use chrono::NaiveDate; use rocket::fairing::AdHoc; use rocket::form; +use rocket::form::validate::range; use rocket::form::ValueField; use rocket::http::Cookie; use rocket::http::CookieJar; @@ -182,6 +183,7 @@ async fn create(db: &State, day: Form) -> Redirect #[derive(FromForm)] struct RegisterForm { day: NaiveDateForm, + #[field(validate = len(3..))] name: String, } @@ -233,21 +235,3 @@ async fn rocket() -> _ { .mount("/public", FileServer::from("static/")) .mount("/", routes![index, create, register, name, setname]) } - -//#[tokio::main] -//async fn main() { -// println!("Hello, world!"); -// let db = Database::connect("sqlite://db.sqlite").await.unwrap(); -// -// let day = day::ActiveModel { -// day: Set("2023-02-08".into()), -// ..Default::default() -// }; -// -// //day.insert(&db).await.unwrap(); -// -// let a: Vec = day::Entity::find().all(&db).await.unwrap(); -// println!("{:?}", a); -// -// db.close().await.unwrap(); -//}