X-Git-Url: http://git.euphorik.ch/?a=blobdiff_plain;f=backend%2Fsrc%2Fmodel.rs;h=4984cdd6844d42625a7ad45a2c105ca36471d355;hb=cdb883c3c4ccbb82774ecfbfad059f3392e75432;hp=ced209d0be14933d4c79ed6c023a8ec53e7d1a93;hpb=89f0943c08854acbc407562f813c4dde1e26fcf6;p=recipes.git diff --git a/backend/src/model.rs b/backend/src/model.rs index ced209d..4984cdd 100644 --- a/backend/src/model.rs +++ b/backend/src/model.rs @@ -1,34 +1,59 @@ -struct Recipe { - ingredients: Vec, - process: Vec, +pub struct Recipe { + pub id: i32, + pub title: String, + pub estimate_time: Option, // [min]. + pub difficulty: Option, + + //ingredients: Vec, // For four people. + pub process: Vec, +} + +impl Recipe { + pub fn new(id: i32, title: String) -> Recipe { + Recipe { + id, + title, + estimate_time: None, + difficulty: None, + process: Vec::new(), + } + } } -struct Ingredient { - quantity: Quantity, - name: String, +pub struct Ingredient { + pub quantity: Option, + pub name: String, } -struct Quantity { - value: f32, - unit: String, +pub struct Quantity { + pub value: f32, + pub unit: String, } -struct Group { - name: String, - steps: Vec, + +pub struct Group { + pub name: Option, + pub steps: Vec, } -struct Step { - action: String, - input: Vec, - output: Vec, +pub struct Step { + pub action: String, + pub input: Vec, + pub output: Vec, } -struct IntermediateSubstance { - name: String, - quantity: Option, +pub struct IntermediateSubstance { + pub name: String, + pub quantity: Option, } -enum StepInput { +pub enum StepInput { Ingredient(Ingredient), - IntermediateSubstance, -} \ No newline at end of file + IntermediateSubstance(IntermediateSubstance), +} + +pub enum Difficulty { + Unknown, + Easy, + Medium, + Hard, +}