From c67d7c6882ccb6ea3ce0e162e7c5ad2bda127e59 Mon Sep 17 00:00:00 2001 From: Andre Medeiros Date: Mon, 26 Jul 2021 13:18:02 -0400 Subject: [PATCH] womp womp --- internal/api/devices.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/api/devices.go b/internal/api/devices.go index b3c0a5b..4c7ef90 100644 --- a/internal/api/devices.go +++ b/internal/api/devices.go @@ -32,8 +32,9 @@ func (a *api) upsertDeviceHandler(w http.ResponseWriter, r *http.Request, _ http func (a *api) testDeviceHandler(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { ctx := context.Background() + tok := ps.ByName("apns") - d, err := a.models.Devices.GetByAPNSToken(ps.ByName("apns")) + d, err := a.models.Devices.GetByAPNSToken(tok) if err != nil { a.logger.WithFields(logrus.Fields{ "err": err, @@ -45,12 +46,12 @@ func (a *api) testDeviceHandler(w http.ResponseWriter, r *http.Request, ps httpr stmt := ` SELECT username FROM accounts - INNER JOIN devices_accounts ON devices.account_id = accounts.id + INNER JOIN devices_accounts ON devices_accounts.account_id = accounts.id WHERE devices_accounts.device_id = $1` rows, err := a.db.Query(ctx, stmt, d.ID) if err != nil { a.logger.WithFields(logrus.Fields{ - "apns": ps.ByName("apns"), + "apns": tok, "err": err, }).Error("failed to fetch device accounts") return