mirror of
https://github.com/sysadminsmedia/homebox.git
synced 2025-12-21 13:23:14 +01:00
ProductBarcode: return more fields from DB (brand, model...)
- backend: change data structure returned to frontend
This commit is contained in:
@@ -92,7 +92,7 @@ type BarcodeProduct struct {
|
||||
// TODO: add asin?
|
||||
ImageURL string `json:"imageURL"`
|
||||
|
||||
item repo.ItemCreate
|
||||
Item repo.ItemCreate `json:"item"`
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -245,8 +245,8 @@ func (ctrl *V1Controller) HandleProductSearchEAN() errchain.HandlerFunc {
|
||||
p.SearchEngineName = "upcitemdb.com"
|
||||
p.Barcode = iEan
|
||||
|
||||
p.item.Description = it.Description
|
||||
p.item.Name = it.Title
|
||||
p.Item.Description = it.Description
|
||||
p.Item.Name = it.Title
|
||||
p.Manufacturer = it.Brand
|
||||
p.ModelNumber = it.Model
|
||||
if len(it.Images) != 0 {
|
||||
@@ -300,8 +300,8 @@ func (ctrl *V1Controller) HandleProductSearchEAN() errchain.HandlerFunc {
|
||||
var p BarcodeProduct
|
||||
p.Barcode = iEan
|
||||
p.SearchEngineName = "barcodespider.com"
|
||||
p.item.Name = result.ItemAttributes.Title
|
||||
p.item.Description = result.ItemAttributes.Description
|
||||
p.Item.Name = result.ItemAttributes.Title
|
||||
p.Item.Description = result.ItemAttributes.Description
|
||||
p.Manufacturer = result.ItemAttributes.Brand
|
||||
p.ModelNumber = result.ItemAttributes.Model
|
||||
p.ImageURL = result.ItemAttributes.Image
|
||||
@@ -329,7 +329,7 @@ func (ctrl *V1Controller) HandleProductSearchEAN() errchain.HandlerFunc {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
|
||||
if len(products) != 0 {
|
||||
return json.NewEncoder(w).Encode(products[0].item)
|
||||
return json.NewEncoder(w).Encode(products[0])
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@@ -221,7 +221,7 @@ const docTemplate = `{
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
"$ref": "#/definitions/repo.ItemCreate"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
"$ref": "#/definitions/repo.ItemCreate"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1564,7 +1564,7 @@ paths:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
type: string
|
||||
$ref: '#/definitions/repo.ItemCreate'
|
||||
security:
|
||||
- Bearer: []
|
||||
summary: Search EAN from Barcode
|
||||
|
||||
@@ -219,7 +219,7 @@
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
"$ref": "#/definitions/repo.ItemCreate"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1564,7 +1564,7 @@ paths:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
type: string
|
||||
$ref: '#/definitions/repo.ItemCreate'
|
||||
security:
|
||||
- Bearer: []
|
||||
summary: Search EAN from Barcode
|
||||
|
||||
@@ -313,8 +313,8 @@
|
||||
|
||||
if(active.params)
|
||||
{
|
||||
form.name = active.params.name;
|
||||
form.description = active.params.description;
|
||||
form.name = active.params.item.name;
|
||||
form.description = active.params.item.description;
|
||||
}
|
||||
|
||||
if (labelId.value) {
|
||||
|
||||
Reference in New Issue
Block a user