|
|
|
@ -834,8 +834,8 @@ func getItemExtHandler(writer http.ResponseWriter, req *http.Request) {
|
|
|
|
|
if req.Method == http.MethodOptions { |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
itemBId, _ := strconv.ParseUint(mux.Vars(req)["id"], 10, 0) |
|
|
|
|
res, err := GetItemB(uint64(itemBId)) |
|
|
|
|
itemExtId, _ := strconv.ParseUint(mux.Vars(req)["id"], 10, 0) |
|
|
|
|
res, err := GetItemExt(uint64(itemExtId)) |
|
|
|
|
if err != nil { |
|
|
|
|
log.Fatal("Error: Typ can't be shown ", err) |
|
|
|
|
writer.WriteHeader(http.StatusInternalServerError) |
|
|
|
@ -862,18 +862,18 @@ func updateItemExtHandler(writer http.ResponseWriter, req *http.Request) {
|
|
|
|
|
writer.WriteHeader(http.StatusBadRequest) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
var itemB Itemb |
|
|
|
|
if req.Form["bezeichnung"] != nil { |
|
|
|
|
itemB.Bezeichnung = req.FormValue("bezeichnung") |
|
|
|
|
itemB.Kurzbeschreibung = req.FormValue("kurzbeschreibung") |
|
|
|
|
itemB.Material = req.FormValue("material") |
|
|
|
|
itemB.Groesse = req.FormValue("groesse") |
|
|
|
|
itemB.Farbe = req.FormValue("farbe") |
|
|
|
|
itbtyp, _ := strconv.ParseUint(req.FormValue("typid"), 10, 0) |
|
|
|
|
itemB.Type.Id = uint(itbtyp) |
|
|
|
|
itemB.Abmessungen.Id, _ = strconv.ParseUint(req.FormValue("abmessungenid"), 10, 0) |
|
|
|
|
itemB.Frontview.Id, _ = strconv.ParseUint(req.FormValue("frontviewid"), 10, 0) |
|
|
|
|
itemB.Id, _ = strconv.ParseUint(req.FormValue("id"), 10, 0) |
|
|
|
|
var itemExt ItemExt |
|
|
|
|
if req.Form["genehmigt"] != nil { |
|
|
|
|
itemExt.Zuhause, _ = strconv.ParseBool(req.FormValue("zuhause")) |
|
|
|
|
itemExt.Draussen, _ = strconv.ParseBool(req.FormValue("draussen")) |
|
|
|
|
itemExt.Genehmigt, _ = strconv.ParseBool(req.FormValue("genehmigt")) |
|
|
|
|
itemExt.Bemerkung = req.FormValue("bemerkung") |
|
|
|
|
itetyp, _ := strconv.ParseUint(req.FormValue("bewertung"), 10, 0) |
|
|
|
|
itemExt.Bewertung = int(itetyp) |
|
|
|
|
itemExt.Favorit, _ = strconv.ParseBool(req.FormValue("abmessungenid")) |
|
|
|
|
itemExt.Frontview.Id, _ = strconv.ParseUint(req.FormValue("frontviewid"), 10, 0) |
|
|
|
|
itemExt.ItemB.Id, _ = strconv.ParseUint(req.FormValue("itembid"), 10, 0) |
|
|
|
|
itemExt.Id, _ = strconv.ParseUint(req.FormValue("id"), 10, 0) |
|
|
|
|
for formKey, formValue := range req.Form { |
|
|
|
|
log.WithFields(log.Fields{formKey: formValue}).Info("parsing from Form: ") |
|
|
|
|
} |
|
|
|
@ -887,9 +887,9 @@ func updateItemExtHandler(writer http.ResponseWriter, req *http.Request) {
|
|
|
|
|
json.Unmarshal(body, &itemB) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
log.Println("Name = ", itemB.Bezeichnung) |
|
|
|
|
log.Info("updating Typ", itemB.Bezeichnung) |
|
|
|
|
res, err := UpdateItemB(itemB) |
|
|
|
|
log.Println("ID = ", itemExt.Id) |
|
|
|
|
log.Info("updating ItemExt", itemExt.Id) |
|
|
|
|
res, err := UpdateItemExt(itemExt) |
|
|
|
|
if err != nil { |
|
|
|
|
writer.WriteHeader(http.StatusInternalServerError) |
|
|
|
|
} |
|
|
|
|