+use chrono::prelude::*;\r
+\r
+pub struct User {\r
+ pub id: i64,\r
+ pub email: String,\r
+}\r
+\r
+pub struct UserLoginInfo {\r
+ pub last_login_datetime: DateTime<Utc>,\r
+ pub ip: String,\r
+ pub user_agent: String,\r
+}\r
+\r
pub struct Recipe {\r
pub id: i64,\r
+ pub user_id: i64,\r
pub title: String,\r
- pub description: Option<String>,\r
+ pub description: String,\r
pub estimate_time: Option<i32>, // [min].\r
- pub difficulty: Option<Difficulty>,\r
+ pub difficulty: Difficulty,\r
\r
//ingredients: Vec<Ingredient>, // For four people.\r
pub process: Vec<Group>,\r
}\r
\r
impl Recipe {\r
- pub fn new(id: i64, title: String, description: Option<String>) -> Recipe {\r
+ pub fn empty(id: i64, user_id: i64) -> Recipe {\r
+ Self::new(id, user_id, String::new(), String::new())\r
+ }\r
+\r
+ pub fn new(id: i64, user_id: i64, title: String, description: String) -> Recipe {\r
Recipe {\r
id,\r
+ user_id,\r
title,\r
description,\r
estimate_time: None,\r
- difficulty: None,\r
+ difficulty: Difficulty::Unknown,\r
process: Vec::new(),\r
}\r
}\r
\r
pub struct Group {\r
pub name: Option<String>,\r
+ pub input: Vec<StepInput>,\r
+ pub output: Vec<IntermediateSubstance>,\r
pub steps: Vec<Step>,\r
}\r
\r
pub struct Step {\r
pub action: String,\r
- pub input: Vec<StepInput>,\r
- pub output: Vec<IntermediateSubstance>,\r
}\r
\r
pub struct IntermediateSubstance {\r