package routers import ( "github.com/gin-gonic/gin" "intent-system/pkg/api" "intent-system/pkg/middleware" ) const ( GroupRouterCustomerV1 = "/api/v1/customer" ) const ( RouterPathCustomerRegister = "/register" RouterPathCustomerURegister = "/uregister" //do not verify email, only register by username. RouterPathCustomerLogin = "/login" RouterSubPathCustomerList = "/list" RouterSubPathCustomerEdit = "/edit" RouterSubPathCustomerLogout = "/logout" RouterSubPathCustomerSubInfo = "/sub-info" RouterSubPathCustomerSubscribe = "/subscribe" RouterSubPathCustomerUnsubscribe = "/unsubscribe" ) func InitRouterGroupCustomer(r *gin.Engine, handlers api.CustomerApi) { g := r.Group(GroupRouterCustomerV1) g.POST(RouterPathCustomerRegister, handlers.CustomerRegister) //do not need JWT authentication g.POST(RouterPathCustomerURegister, handlers.CustomerURegister) g.POST(RouterPathCustomerLogin, handlers.CustomerLogin) //do not need JWT authentication g.POST(RouterSubPathCustomerSubInfo, handlers.CustomerSubInfo) //do not need JWT authentication g.POST(RouterSubPathCustomerSubscribe, handlers.CustomerSubscribe) //do not need JWT authentication g.POST(RouterSubPathCustomerUnsubscribe, handlers.CustomerUnsubscribe) //do not need JWT authentication g.POST(RouterSubPathCustomerEdit, handlers.CustomerEdit) //do not need JWT authentication g.Use(middleware.JWT()) //use JWT token middleware { g.POST(RouterSubPathCustomerList, handlers.CustomerList) g.POST(RouterSubPathCustomerLogout, handlers.CustomerLogout) } }