Skip to content

A continuation of HomeBox the inventory and organization system built for the Home User

ProductBarcode: refactoring Go method

Crumb Owl24923f2a83f4
diff --git a/backend/app/api/handlers/v1/v1_ctrl_product_search.go b/backend/app/api/handlers/v1/v1_ctrl_product_search.go
index 24d9aefb..922fa67d 100644
--- a/backend/app/api/handlers/v1/v1_ctrl_product_search.go
+++ b/backend/app/api/handlers/v1/v1_ctrl_product_search.go
@@ -96,7 +96,7 @@ type BARCODESPIDER_COMResponse struct {
// @Success 200 {object} []repo.BarcodeProduct
// @Router /v1/getproductfromean [GET]
// @Security Bearer
-func (ctrl *V1Controller) HandleProductSearchFromEAN(conf config.BarcodeAPIConf) errchain.HandlerFunc {
+func (ctrl *V1Controller) HandleProductSearchFromBarcode(conf config.BarcodeAPIConf) errchain.HandlerFunc {
type query struct {
// 4,296 characters is the maximum length of a QR code
EAN string `schema:"productEAN" validate:"required,max=4296"`
diff --git a/backend/app/api/routes.go b/backend/app/api/routes.go
index 9d7772ae..91840946 100644
--- a/backend/app/api/routes.go
+++ b/backend/app/api/routes.go
@@ -158,7 +158,7 @@ func (a *app) mountRoutes(r *chi.Mux, chain *errchain.ErrChain, repos *repo.AllR
}
r.Get("/qrcode", chain.ToHandlerFunc(v1Ctrl.HandleGenerateQRCode(), assetMW...))
- r.Get("/getproductfromean", chain.ToHandlerFunc(v1Ctrl.HandleProductSearchEAN(a.conf.Barcode), userMW...))
+ r.Get("/getproductfromean", chain.ToHandlerFunc(v1Ctrl.HandleProductSearchFromBarcode(a.conf.Barcode), userMW...))
r.Get(
"/items/{id}/attachments/{attachment_id}",
chain.ToHandlerFunc(v1Ctrl.HandleItemAttachmentGet(), assetMW...),