module updates

This commit is contained in:
James Tombleson 2024-04-05 17:50:29 -07:00
parent 671ee21355
commit 4e4fee53bf
3 changed files with 10 additions and 7 deletions

View File

@ -2,9 +2,10 @@ package v1
import ( import (
"fmt" "fmt"
"go-cook/api/domain"
"net/http" "net/http"
"git.jamestombleson.com/jtom38/go-cook/api/domain"
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
) )
@ -45,7 +46,7 @@ func (h *Handler) ProtectedRoute(c echo.Context) error {
h.ReturnUnauthorizedResponse(c, err.Error()) h.ReturnUnauthorizedResponse(c, err.Error())
} }
err = token.IsValid(domain.ScopeRecipeRead) err = token.IsValid(domain.ScopeRecipeRead)
if err != nil { if err != nil {
h.ReturnUnauthorizedResponse(c, ErrJwtScopeMissing) h.ReturnUnauthorizedResponse(c, ErrJwtScopeMissing)
} }

View File

@ -2,11 +2,12 @@ package v1
import ( import (
"database/sql" "database/sql"
"go-cook/api/domain"
"go-cook/api/repositories"
"go-cook/api/services"
"net/http" "net/http"
"git.jamestombleson.com/jtom38/go-cook/api/repositories"
"git.jamestombleson.com/jtom38/go-cook/api/services"
"git.jamestombleson.com/jtom38/go-cook/api/domain"
"github.com/golang-jwt/jwt/v5" "github.com/golang-jwt/jwt/v5"
echojwt "github.com/labstack/echo-jwt/v4" echojwt "github.com/labstack/echo-jwt/v4"
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
@ -43,7 +44,7 @@ func (h *Handler) Register(v1 *echo.Group) {
auth.Use(echojwt.WithConfig(jwtConfig)) auth.Use(echojwt.WithConfig(jwtConfig))
auth.POST("/scopes/add", h.AddScopes) auth.POST("/scopes/add", h.AddScopes)
auth.POST("/scopes/remove", h.RemoveScopes) auth.POST("/scopes/remove", h.RemoveScopes)
demo := v1.Group("/demo") demo := v1.Group("/demo")
demo.GET("/hello", h.DemoHello) demo.GET("/hello", h.DemoHello)
demo.GET("/hello/:who", h.HelloWho) demo.GET("/hello/:who", h.HelloWho)

View File

@ -2,10 +2,11 @@ package v1
import ( import (
"errors" "errors"
"go-cook/api/domain"
"strings" "strings"
"time" "time"
"git.jamestombleson.com/jtom38/go-cook/api/domain"
"github.com/golang-jwt/jwt/v5" "github.com/golang-jwt/jwt/v5"
) )