Skip to content

Commit e4b38a6

Browse files
committed
fix(inventory): align device constants
1 parent ff728a1 commit e4b38a6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

services/inventory/server/server.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ func (s *Server) registerDevice(w http.ResponseWriter, r *http.Request) {
306306
}
307307

308308
func (s *Server) getDevice(w http.ResponseWriter, r *http.Request) {
309-
id := chi.URLParam(r, "deviceID")
309+
id := chi.URLParam(r, deviceIDParam)
310310
var d Device
311311
if err := s.db.QueryRow(`SELECT id, public_key, posture, registered_at, last_updated FROM devices WHERE id=$1`, id).Scan(&d.ID, &d.PublicKey, &d.Posture, &d.Registered, &d.LastUpdated); err != nil {
312312
if errors.Is(err, sql.ErrNoRows) {
@@ -322,7 +322,7 @@ func (s *Server) getDevice(w http.ResponseWriter, r *http.Request) {
322322
}
323323

324324
func (s *Server) updateDevice(w http.ResponseWriter, r *http.Request) {
325-
id := chi.URLParam(r, "deviceID")
325+
id := chi.URLParam(r, deviceIDParam)
326326
var payload struct {
327327
Posture string `json:"posture"`
328328
}
@@ -336,7 +336,7 @@ func (s *Server) updateDevice(w http.ResponseWriter, r *http.Request) {
336336
http.Error(w, "db error", http.StatusInternalServerError)
337337
return
338338
}
339-
if err := json.NewEncoder(w).Encode(map[string]string{"status": "updated"}); err != nil {
339+
if err := json.NewEncoder(w).Encode(map[string]string{statusKey: statusUpdated}); err != nil {
340340
log.Printf("failed to encode update device response: %v", err)
341341
}
342342
}

0 commit comments

Comments
 (0)