package router

import (
	"cold-delivery/common/actions"
	"github.com/gin-gonic/gin"

	"cold-delivery/app/admin/controller"
	jwt "gogs.baozhida.cn/zoie/OAuth-core/pkg/jwtauth"
)

func init() {
	routerCheckRole = append(routerCheckRole, registerCustomerRouter)

}

// 需认证的路由代码
func registerCustomerRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
	cont := controller.Customer{}
	r := v1.Group("/customer").Use(authMiddleware.MiddlewareFunc()).Use(actions.PermissionAction())
	{
		r.GET("", cont.GetPage)
		r.GET("/:id", cont.Get)
		r.POST("", cont.Insert)
		r.PUT("", cont.Update)
		r.DELETE("", cont.Delete)
		r.PUT("/pwd/reset", cont.ResetPwd)
		r.GET("/profile", cont.GetProfile)
		r.PUT("/pwd/set", cont.UpdatePwd)

	}
}
