mirror of
https://github.com/sysadminsmedia/homebox.git
synced 2025-12-21 13:23:14 +01:00
ProductBarcode: refactoring Go method
This commit is contained in:
@@ -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"`
|
||||
|
||||
@@ -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...),
|
||||
|
||||
Reference in New Issue
Block a user