From 72b5bdde4f6f5f2d81e671e07e6523df42b808ef Mon Sep 17 00:00:00 2001 From: Jan Bader Date: Tue, 15 Feb 2022 12:59:53 +0000 Subject: [PATCH] Minor fixes --- cmd/budgeteer/main.go | 4 ++-- http/session.go | 4 ++-- postgres/numeric.go | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cmd/budgeteer/main.go b/cmd/budgeteer/main.go index ea6a673..eb40d98 100644 --- a/cmd/budgeteer/main.go +++ b/cmd/budgeteer/main.go @@ -30,12 +30,12 @@ func main() { panic("couldn't open static files") } - h := &http.Handler{ + handler := &http.Handler{ Service: q, TokenVerifier: &jwt.TokenVerifier{}, CredentialsVerifier: &bcrypt.Verifier{}, StaticFS: netHttp.FS(static), } - h.Serve() + handler.Serve() } diff --git a/http/session.go b/http/session.go index 421ea4c..0805ab8 100644 --- a/http/session.go +++ b/http/session.go @@ -73,7 +73,7 @@ func (h *Handler) loginPost(c *gin.Context) { return } - t, err := h.TokenVerifier.CreateToken(&user) + token, err := h.TokenVerifier.CreateToken(&user) if err != nil { c.AbortWithError(http.StatusUnauthorized, err) } @@ -85,7 +85,7 @@ func (h *Handler) loginPost(c *gin.Context) { return } - c.JSON(http.StatusOK, LoginResponse{t, user, budgets}) + c.JSON(http.StatusOK, LoginResponse{token, user, budgets}) } type LoginResponse struct { diff --git a/postgres/numeric.go b/postgres/numeric.go index 3d477b6..6f89f81 100644 --- a/postgres/numeric.go +++ b/postgres/numeric.go @@ -72,6 +72,7 @@ func (n Numeric) Sub(o Numeric) Numeric { panic("Cannot subtract with different exponents") } + func (n Numeric) Add(o Numeric) Numeric { left := n right := o