43 lines
1.1 KiB
Go
43 lines
1.1 KiB
Go
package routes
|
|
|
|
import (
|
|
"easywish/internal/controllers"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func SetupRoutes(r *gin.Engine) *gin.Engine {
|
|
apiGroup := r.Group("/api")
|
|
{
|
|
serviceGroup := apiGroup.Group("/service")
|
|
{
|
|
serviceGroup.GET("/health", controllers.HealthCheck)
|
|
}
|
|
|
|
authGroup := apiGroup.Group("/auth")
|
|
{
|
|
authGroup.POST("/registrationBegin", controllers.RegistrationBegin)
|
|
authGroup.POST("/registrationComplete", controllers.RegistrationComplete)
|
|
authGroup.POST("/login", controllers.Login)
|
|
authGroup.POST("/refresh", controllers.Refresh)
|
|
authGroup.POST("/passwordResetBegin", controllers.PasswordResetBegin)
|
|
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)
|
|
}
|
|
}
|
|
|
|
return r
|
|
}
|