2022-08-18 18:54:21 +08:00
|
|
|
package router
|
|
|
|
|
|
|
|
import (
|
|
|
|
v1 "github.com/1Panel-dev/1Panel/app/api/v1"
|
|
|
|
"github.com/1Panel-dev/1Panel/middleware"
|
|
|
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
)
|
|
|
|
|
|
|
|
type HostRouter struct{}
|
|
|
|
|
|
|
|
func (s *HostRouter) InitHostRouter(Router *gin.RouterGroup) {
|
|
|
|
userRouter := Router.Group("hosts")
|
|
|
|
userRouter.Use(middleware.JwtAuth()).Use(middleware.SessionAuth())
|
|
|
|
withRecordRouter := userRouter.Use(middleware.OperationRecord())
|
|
|
|
baseApi := v1.ApiGroupApp.BaseApi
|
|
|
|
{
|
2022-08-30 18:49:07 +08:00
|
|
|
withRecordRouter.POST("", baseApi.CreateHost)
|
2022-08-18 18:54:21 +08:00
|
|
|
withRecordRouter.POST("/del", baseApi.DeleteHost)
|
2022-08-30 18:49:07 +08:00
|
|
|
userRouter.POST("/search", baseApi.HostTree)
|
2022-08-18 18:54:21 +08:00
|
|
|
userRouter.PUT(":id", baseApi.UpdateHost)
|
|
|
|
}
|
|
|
|
}
|