2024-10-01 20:28:58 +02:00
|
|
|
package handlers
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
2024-10-02 10:36:08 +02:00
|
|
|
"git.espin.casa/albert/cml04-falcon-system/handset/publisher"
|
2024-10-01 20:28:58 +02:00
|
|
|
"github.com/julienschmidt/httprouter"
|
|
|
|
)
|
|
|
|
|
2024-10-02 10:36:08 +02:00
|
|
|
func BarCodeHandler(publisher publisher.Publisher) httprouter.Handle {
|
2024-10-01 20:28:58 +02:00
|
|
|
return func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
|
|
|
barcode := ps.ByName("barcode")
|
2024-10-02 10:36:08 +02:00
|
|
|
if err := publisher.Barcode(r.Context(), barcode); err != nil {
|
2024-10-01 20:28:58 +02:00
|
|
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|