feat: auth middleware;
fix: backend healthcheck
This commit is contained in:
@@ -2,6 +2,7 @@ package routes
|
||||
|
||||
import (
|
||||
"easywish/internal/controllers"
|
||||
"easywish/internal/middleware"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
@@ -24,18 +25,27 @@ func SetupRoutes(r *gin.Engine) *gin.Engine {
|
||||
authGroup.POST("/passwordResetComplete", controllers.PasswordResetComplete)
|
||||
}
|
||||
|
||||
accountGroup := apiGroup.Group("/account")
|
||||
{
|
||||
accountGroup.PUT("/changePassword", controllers.ChangePassword)
|
||||
}
|
||||
|
||||
profileGroup := apiGroup.Group("/profile")
|
||||
{
|
||||
profileGroup.GET("/:username", controllers.GetProfile)
|
||||
profileGroup.GET("/me", controllers.GetOwnProfile)
|
||||
profileGroup.GET("/privacy", controllers.GetPrivacySettings)
|
||||
profileGroup.PATCH("/privacy", controllers.UpdatePrivacySettings)
|
||||
}
|
||||
|
||||
protected := apiGroup.Group("")
|
||||
protected.Use(middleware.JWTAuthMiddleware())
|
||||
{
|
||||
accountGroup := protected.Group("/account")
|
||||
{
|
||||
accountGroup.PUT("/changePassword", controllers.ChangePassword)
|
||||
}
|
||||
|
||||
profileGroup := protected.Group("/profile")
|
||||
{
|
||||
profileGroup.GET("/me", controllers.GetOwnProfile)
|
||||
profileGroup.GET("/privacy", controllers.GetPrivacySettings)
|
||||
profileGroup.PATCH("/privacy", controllers.UpdatePrivacySettings)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return r
|
||||
|
||||
Reference in New Issue
Block a user