ot_alert_policy.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package router
  2. import (
  3. "github.com/gin-gonic/gin"
  4. jwt "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth"
  5. "go-admin/app/admin/apis"
  6. "go-admin/common/actions"
  7. "go-admin/common/middleware"
  8. )
  9. func init() {
  10. routerCheckRole = append(routerCheckRole, registerOtAlertPolicyRouter)
  11. // routerNoCheckRole = append(routerNoCheckRole, registerOtAlertPolicyRouterNocheck)
  12. }
  13. // registerOtAlertPolicyRouter
  14. func registerOtAlertPolicyRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
  15. api := apis.OtAlertPolicy{}
  16. r := v1.Group("/alert-policy").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
  17. {
  18. r.GET("", actions.PermissionAction(), api.GetPage)
  19. r.GET("/:id", actions.PermissionAction(), api.Get)
  20. r.POST("", api.Insert)
  21. r.PUT("/:id", actions.PermissionAction(), api.Update)
  22. r.DELETE("", api.Delete)
  23. r.POST("/import", api.SetPolicy)
  24. }
  25. }
  26. // func registerOtAlertPolicyRouterNocheck(v1 *gin.RouterGroup) {
  27. // api := apis.OtAlertPolicy{}
  28. // r := v1.Group("/test/alert-policy")
  29. // {
  30. // r.GET("", api.GetPage)
  31. // r.GET("/:id", api.Get)
  32. // r.POST("", api.Insert)
  33. // r.PUT("/:id", api.Update)
  34. // r.DELETE("", api.Delete)
  35. // r.POST("/import", api.SetPolicy)
  36. // }
  37. // }