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: i64, pub user_id: i64, pub title: String, pub description: String, pub estimate_time: Option, // [min]. pub difficulty: Difficulty, //ingredients: Vec, // For four people. pub process: Vec, } impl 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: Difficulty::Unknown, process: Vec::new(), } } } pub struct Ingredient { pub quantity: Option, pub name: String, } pub struct Quantity { pub value: f32, pub unit: String, } pub struct Group { pub name: Option, pub input: Vec, pub output: Vec, pub steps: Vec, } pub struct Step { pub action: String, } pub struct IntermediateSubstance { pub name: String, pub quantity: Option, } pub enum StepInput { Ingredient(Ingredient), IntermediateSubstance(IntermediateSubstance), } pub enum Difficulty { Unknown, Easy, Medium, Hard, }