From 57157a64c7f934faea9dab4317a8d80ea58728a4 Mon Sep 17 00:00:00 2001 From: Tucker Evans Date: Sat, 9 Nov 2019 19:15:53 -0500 Subject: Add Recipe Type (w/ subtypes Ingredients & Steps) --- backend/recipe.go | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 backend/recipe.go diff --git a/backend/recipe.go b/backend/recipe.go new file mode 100644 index 0000000..4fb8816 --- /dev/null +++ b/backend/recipe.go @@ -0,0 +1,45 @@ +package main + +type Ingredient struct { + Name string + Amount float64 + Unit string +} + +type Step struct { + Num int + Desc string + Time int +} + +type Recipe struct { + Id int + Title string + Desc string + Photos []string + Serving_size int + Cook_time int + Rating int + Keywords []string + Ingredients []Ingredient + Steps []Step +} + +func MakeRecipe() *Recipe { + var r Recipe + + r = Recipe{ + Id: 0, + Title: "", + Desc: "", + Serving_size: 0, + Cook_time: 0, + Rating: 5, + Keywords: make([]string, 0), + Ingredients: make([]Ingredient, 0), + Steps: make([]Step, 0)} + + return &r + +} + -- cgit v1.1