This commit is contained in:
philipp 2023-02-09 13:19:00 +01:00
parent 5200150828
commit 03dcfc6255
3 changed files with 4 additions and 35 deletions

View File

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

BIN
db.sqlite

Binary file not shown.

View File

@ -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<DatabaseConnection>, day: Form<DayForm>) -> 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::Model> = day::Entity::find().all(&db).await.unwrap();
// println!("{:?}", a);
//
// db.close().await.unwrap();
//}