add topping recipe display & fix bugs
This commit is contained in:
parent
7d6988f581
commit
ece4cef205
8 changed files with 421 additions and 33 deletions
|
|
@ -504,6 +504,34 @@ func (rr *RecipeRouter) updateRecipe(w http.ResponseWriter, r *http.Request) {
|
|||
})
|
||||
}
|
||||
|
||||
func (rr *RecipeRouter) updateMaterialSetting(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Add("Content-Type", "application/json")
|
||||
|
||||
country := r.URL.Query().Get("country")
|
||||
filename := r.URL.Query().Get("filename")
|
||||
|
||||
rr.taoLogger.Log.Debug("RecipeRouter.updateMaterialSetting", zap.Any("country", country), zap.Any("filename", filename))
|
||||
|
||||
countryID, err := rr.data.GetCountryIDByName(country)
|
||||
if err != nil {
|
||||
http.Error(w, fmt.Sprintf("Country Name: %s not found!!!", country), http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
|
||||
updateMutex.Lock()
|
||||
defer updateMutex.Unlock()
|
||||
// get material setting
|
||||
materialSetting := rr.data.GetMaterialSetting(countryID, filename)
|
||||
|
||||
if len(materialSetting) == 0 {
|
||||
http.Error(w, fmt.Sprintf("Recipe country: %s file: %s found empty settings.", country, filename), http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
|
||||
// TODO: create commit and set change
|
||||
|
||||
}
|
||||
|
||||
func (rr *RecipeRouter) getSavedRecipes(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
file_version := chi.URLParam(r, "filename_version_only")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue