package domain import ( "github.com/gin-gonic/gin" "github.com/golang-jwt/jwt/v5" domainAuth "github.com/haydenhargreaves/Potion/internal/domain/auth" domainRecipe "github.com/haydenhargreaves/Potion/internal/domain/recipe" domainUser "github.com/haydenhargreaves/Potion/internal/domain/user" ) // InjectedDependencies is a collection of dependencies that are injected into the application. They // are stored in the context and can be accessed by handlers via the context. type InjectedDependencies struct { UserService domainUser.UserService AuthService domainAuth.AuthService RecipeService domainRecipe.RecipeService } // JwtClaims is the data stored in the JSON web token. All that is needed is the users ID and their // Google email provided. type JwtClaims struct { UserId int `json:"id"` Email string `json:"email"` jwt.RegisteredClaims } // IsLoggedIn checks the cookies in a request and returns whether the user is logged in. func IsLoggedIn(ctx *gin.Context) bool { _, id := ctx.Get("userId") _, email := ctx.Get("userEmail") return id && email }