X-Git-Url: http://git.euphorik.ch/?a=blobdiff_plain;f=backend%2Fsrc%2Fmodel.rs;h=0ed482514b43dd2084b817afc738db3b6a1a11e7;hb=cc2e5b6893b582b4b5c4e7a93e914a189f6a959b;hp=4984cdd6844d42625a7ad45a2c105ca36471d355;hpb=cdb883c3c4ccbb82774ecfbfad059f3392e75432;p=recipes.git diff --git a/backend/src/model.rs b/backend/src/model.rs index 4984cdd..0ed4825 100644 --- a/backend/src/model.rs +++ b/backend/src/model.rs @@ -1,20 +1,41 @@ +use chrono::prelude::*; + +pub struct User { + pub id: i64, + pub email: String, +} + +pub struct UserLoginInfo { + pub last_login_datetime: DateTime, + pub ip: String, + pub user_agent: String, +} + pub struct Recipe { - pub id: i32, + pub id: i64, + pub user_id: i64, pub title: String, + pub description: String, pub estimate_time: Option, // [min]. - pub difficulty: Option, + pub difficulty: Difficulty, //ingredients: Vec, // For four people. pub process: Vec, } impl Recipe { - pub fn new(id: i32, title: String) -> Recipe { + pub fn empty(id: i64, user_id: i64) -> Recipe { + Self::new(id, user_id, String::new(), String::new()) + } + + pub fn new(id: i64, user_id: i64, title: String, description: String) -> Recipe { Recipe { id, + user_id, title, + description, estimate_time: None, - difficulty: None, + difficulty: Difficulty::Unknown, process: Vec::new(), } } @@ -32,13 +53,13 @@ pub struct Quantity { pub struct Group { pub name: Option, + pub input: Vec, + pub output: Vec, pub steps: Vec, } pub struct Step { pub action: String, - pub input: Vec, - pub output: Vec, } pub struct IntermediateSubstance {