Hayden Hargreaves b17c5774e9 (UI): Implemented much of the frontend recipe creation wizard.
Most everything is implemented, included a state handler and a pretty
simple (but workable) system for managing state in HTML. Nice and simple
for now.

There is still much work to be done, but the rest is simple backend
creation and error handling. And then input validation...a nightmare.
2025-06-29 22:30:20 -07:00

29 lines
778 B
Go

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"
)
type InjectedDependencies struct {
UserService domainUser.UserService
AuthService domainAuth.AuthService
RecipeService domainRecipe.RecipeService
}
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
}