projects
/
recipes.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Service for editing/creating recipe
[recipes.git]
/
backend
/
src
/
model.rs
diff --git
a/backend/src/model.rs
b/backend/src/model.rs
index
d0f95d2
..
0ed4825
100644
(file)
--- a/
backend/src/model.rs
+++ b/
backend/src/model.rs
@@
-1,22
+1,41
@@
+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 struct Recipe {
\r
pub id: i64,
\r
+ pub user_id: i64,
\r
pub title: String,
\r
pub title: String,
\r
- pub description:
Option<String>
,
\r
+ pub description:
String
,
\r
pub estimate_time: Option<i32>, // [min].
\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
\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
Recipe {
\r
id,
\r
+ user_id,
\r
title,
\r
description,
\r
estimate_time: None,
\r
title,
\r
description,
\r
estimate_time: None,
\r
- difficulty:
None
,
\r
+ difficulty:
Difficulty::Unknown
,
\r
process: Vec::new(),
\r
}
\r
}
\r
process: Vec::new(),
\r
}
\r
}
\r
@@
-34,13
+53,13
@@
pub struct Quantity {
\r
pub struct Group {
\r
pub name: Option<String>,
\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 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
}
\r
\r
pub struct IntermediateSubstance {
\r