22 lines
724 B
Go
22 lines
724 B
Go
package router
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
jwt "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth"
|
|
|
|
"go-admin/app/bell/contact"
|
|
"go-admin/common/middleware"
|
|
)
|
|
|
|
func init() { registrars = append(registrars, registerContactRouter) }
|
|
func registerContactRouter(v1 *gin.RouterGroup, auth *jwt.GinJWTMiddleware) {
|
|
h := contact.Handler{}
|
|
secured := v1.Group("").Use(auth.MiddlewareFunc()).Use(middleware.AuthCheckRole())
|
|
secured.GET("/contacts", h.List)
|
|
secured.POST("/contacts", h.Create)
|
|
secured.PUT("/contacts/:id", h.Update)
|
|
secured.PUT("/contacts/:id/enabled", h.SetEnabled)
|
|
secured.POST("/contacts/:id/channels", h.AddChannel)
|
|
secured.POST("/contact-channels/:id/validations", h.ValidateChannel)
|
|
}
|