Skip to content

Commit

Permalink
refactor: improve FoodSearchResponseWithoutAuth model
Browse files Browse the repository at this point in the history
Signed-off-by: jnelle <[email protected]>
  • Loading branch information
jnelle committed Oct 2, 2022
1 parent f55ae9e commit 52c2742
Showing 1 changed file with 27 additions and 48 deletions.
75 changes: 27 additions & 48 deletions app/models/food_response_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,52 +59,31 @@ type Items struct {
}

type FoodSearchResponseWithoutAuth struct {
Items []struct {
Item struct {
BrandName string `json:"brand_name"`
CountryCode string `json:"country_code"`
Deleted bool `json:"deleted"`
Description string `json:"description"`
ID float64 `json:"id"`
NutritionalContents struct {
Calcium float64 `json:"calcium"`
Carbohydrates float64 `json:"carbohydrates"`
Cholesterol float64 `json:"cholesterol"`
Energy struct {
Unit string `json:"unit"`
Value float64 `json:"value"`
} `json:"energy"`
Fat float64 `json:"fat"`
Fiber float64 `json:"fiber"`
Iron float64 `json:"iron"`
MonounsaturatedFat float64 `json:"monounsaturated_fat"`
PolyunsaturatedFat float64 `json:"polyunsaturated_fat"`
Potassium float64 `json:"potassium"`
Protein float64 `json:"protein"`
SaturatedFat float64 `json:"saturated_fat"`
Sodium float64 `json:"sodium"`
Sugar float64 `json:"sugar"`
TransFat float64 `json:"trans_fat"`
VitaminA float64 `json:"vitamin_a"`
VitaminC float64 `json:"vitamin_c"`
} `json:"nutritional_contents"`
Public bool `json:"public"`
ServingSizes []struct {
ID string `json:"id"`
Index float64 `json:"index"`
NutritionMultiplier float64 `json:"nutrition_multiplier"`
Unit string `json:"unit"`
Value float64 `json:"value"`
} `json:"serving_sizes"`
Type string `json:"type"`
UserID string `json:"user_id"`
Verified bool `json:"verified"`
Version string `json:"version"`
} `json:"item"`
Tags []interface{} `json:"tags"`
Type string `json:"type"`
} `json:"items"`
Meta struct {
TotalEntries int `json:"total_entries"`
} `json:"meta"`
Items []FoodSearchResponseWithoutAuthItems `json:"items"`
Meta Meta `json:"meta"`
}

type FoodSearchResponseWithoutAuthItems struct {
Item FoodSearchResponseWithoutAuthItem `json:"item"`
Tags []interface{} `json:"tags"`
Type string `json:"type"`
}

type FoodSearchResponseWithoutAuthItem struct {
BrandName string `json:"brand_name"`
CountryCode string `json:"country_code"`
Deleted bool `json:"deleted"`
Description string `json:"description"`
ID int `json:"id"`
NutritionalContents NutritionalContents `json:"nutritional_contents"`
Public bool `json:"public"`
ServingSizes []ServingSizes `json:"serving_sizes"`
Type string `json:"type"`
UserID string `json:"user_id"`
Verified bool `json:"verified"`
Version string `json:"version"`
}

type Meta struct {
TotalEntries int `json:"total_entries"`
}

0 comments on commit 52c2742

Please sign in to comment.