feat: auth middleware;

fix: backend healthcheck
This commit is contained in:
2025-06-19 14:08:51 +03:00
parent fed517f905
commit 4e3554346a
7 changed files with 118 additions and 23 deletions

View File

@@ -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