summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTucker Evans <tuckerevans24@gmail.com>2019-12-02 10:52:47 -0500
committerTucker Evans <tuckerevans24@gmail.com>2019-12-02 10:52:47 -0500
commit74855d03f44adf2e77d5d6af38e18e1cfe45e700 (patch)
treee26fcc8bb51d28811a7cedf2a6615e37f84402ad
parentfe7f2f4f42b77dc2fe1c1826bd44c082b781d92a (diff)
Fix changes json encoding to match frontend
-rw-r--r--backend/recipe.go35
1 files changed, 18 insertions, 17 deletions
diff --git a/backend/recipe.go b/backend/recipe.go
index fed83ca..8589beb 100644
--- a/backend/recipe.go
+++ b/backend/recipe.go
@@ -5,29 +5,30 @@ import "errors"
import "strings"
type Ingredient struct {
- Name string
- Amount float64
- Unit string
+ Name string `json:"name"`
+ Amount float64 `json:"amount"`
+ Unit string `json:"units"`
+ Type string `json:"type"`
}
type Step struct {
- Num int
- Desc string
- Time int
+ Num int `json:"index"` //Is this needed
+ Desc string `json:"instructions"`
+ Time int `json:"timer"`
}
type Recipe struct {
- Id int
- Title string
- Desc string
- Photos []string
- Serving_size int
- Cook_time int
- Rating int
- Num_cooked int
- Keywords []string
- Ingredients []Ingredient
- Steps []Step
+ Id int `json:"id"`
+ Title string `json:"name"`
+ Desc string `json:"description"`
+ Photos []string `json:"photos"`
+ Serving_size int `json:"servingSize"`
+ Cook_time int `json:"cookTime"`
+ Rating int `json:"rating"`
+ Num_cooked int `json:"timesCooked"`
+ Keywords []string `json:"tags"`
+ Ingredients []Ingredient `json:"ingredients"`
+ Steps []Step `json:"steps"`
}
func MakeRecipe() *Recipe {