diff --git a/handset/app/app.go b/handset/app/app.go index 7dad607..99e6aee 100644 --- a/handset/app/app.go +++ b/handset/app/app.go @@ -8,8 +8,8 @@ import ( "syscall" "time" - "git.espin.casa/albert/cml04-falcon-system/handset/publisher" "git.espin.casa/albert/cml04-falcon-system/handset/routes" + "git.espin.casa/albert/cml04-falcon-system/internal/publisher" "git.espin.casa/albert/logger" "github.com/julienschmidt/httprouter" "github.com/nats-io/nats.go" diff --git a/handset/handlers/barcode.go b/handset/handlers/barcode.go index 107d751..5d127e1 100644 --- a/handset/handlers/barcode.go +++ b/handset/handlers/barcode.go @@ -3,14 +3,14 @@ package handlers import ( "net/http" - "git.espin.casa/albert/cml04-falcon-system/handset/publisher" + "git.espin.casa/albert/cml04-falcon-system/internal/publisher" "github.com/julienschmidt/httprouter" ) func BarCodeHandler(publisher publisher.Publisher) httprouter.Handle { return func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { barcode := ps.ByName("barcode") - if err := publisher.Barcode(r.Context(), barcode); err != nil { + if err := publisher.NewBarcode(r.Context(), barcode); err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) } } diff --git a/handset/routes/routes.go b/handset/routes/routes.go index 03575ba..934b178 100644 --- a/handset/routes/routes.go +++ b/handset/routes/routes.go @@ -2,7 +2,7 @@ package routes import ( "git.espin.casa/albert/cml04-falcon-system/handset/handlers" - "git.espin.casa/albert/cml04-falcon-system/handset/publisher" + "git.espin.casa/albert/cml04-falcon-system/internal/publisher" "github.com/julienschmidt/httprouter" ) diff --git a/handset/publisher/publisher.go b/internal/publisher/publisher.go similarity index 82% rename from handset/publisher/publisher.go rename to internal/publisher/publisher.go index 03c7588..f8b556f 100644 --- a/handset/publisher/publisher.go +++ b/internal/publisher/publisher.go @@ -10,14 +10,14 @@ import ( ) type Publisher interface { - Barcode(ctx context.Context, barcode string) error + NewBarcode(ctx context.Context, barcode string) error } type publisher struct { nc *nats.Conn } -func (e *publisher) Barcode(ctx context.Context, barcode string) error { +func (e *publisher) NewBarcode(ctx context.Context, barcode string) error { // create event message evt := cml04eventer.NewEvent("falcon-handset", "barcode.new", nil, []byte(barcode)) // create buffer message data