refactor: split backend transport and domain modules

This commit is contained in:
2026-08-14 01:04:21 +08:00
parent acba9624d7
commit e6775f0966
59 changed files with 2733 additions and 1963 deletions
+20
View File
@@ -0,0 +1,20 @@
package router
import (
"kra/internal/server/handler"
"github.com/gin-gonic/gin"
)
func RegisterAnnouncement(private, public *gin.RouterGroup, h *handler.Announcement) {
privateInfo := private.Group("/info")
privateInfo.POST("/createInfo", h.Create)
privateInfo.DELETE("/deleteInfo", h.Delete)
privateInfo.DELETE("/deleteInfoByIds", h.DeleteByIDs)
privateInfo.PUT("/updateInfo", h.Update)
privateInfo.GET("/findInfo", h.Find)
privateInfo.GET("/getInfoList", h.List)
publicInfo := public.Group("/info")
publicInfo.GET("/getInfoDataSource", h.DataSource)
publicInfo.GET("/getInfoPublic", h.Public)
}
+28
View File
@@ -0,0 +1,28 @@
package router
import (
"kra/internal/server/handler"
"github.com/gin-gonic/gin"
)
func RegisterAPI(group *gin.RouterGroup, engine *gin.Engine, h *handler.API) {
api := group.Group("/api")
api.POST("/getApiList", h.List)
api.POST("/getAllApis", h.All)
api.POST("/createApi", h.Create)
api.POST("/updateApi", h.Update)
api.POST("/deleteApi", h.Delete)
api.DELETE("/deleteApisByIds", h.DeleteByIDs)
api.POST("/getApiById", h.Find)
api.GET("/getApiGroups", h.Groups)
api.GET("/getApiRoles", h.Roles)
api.POST("/setApiRoles", h.SetRoles)
api.GET("/syncApi", h.Sync(engine))
api.POST("/ignoreApi", h.Ignore)
api.POST("/enterSyncApi", h.ApplySync)
api.GET("/freshCasbin", h.FreshCasbin)
casbin := group.Group("/casbin")
casbin.POST("/updateCasbin", h.SetPolicyPaths)
casbin.POST("/getPolicyPathByAuthorityId", h.PolicyPaths)
}
+20
View File
@@ -0,0 +1,20 @@
package router
import (
"kra/internal/server/handler"
"github.com/gin-gonic/gin"
)
func RegisterAuthority(group *gin.RouterGroup, h *handler.Authority) {
router := group.Group("/authority")
router.POST("/getAuthorityList", h.List)
router.POST("/createAuthority", h.Create)
router.POST("/copyAuthority", h.Copy)
router.PUT("/updateAuthority", h.Update)
router.POST("/deleteAuthority", h.Delete)
router.POST("/setRoleUsers", h.SetUsers)
router.GET("/getUsersByAuthority", h.Users)
router.POST("/setDataScope", h.SetDataScope)
router.GET("/getDataScopeDepts", h.DataScopeDepartments)
}
+13
View File
@@ -0,0 +1,13 @@
package router
import (
"kra/internal/server/handler"
"github.com/gin-gonic/gin"
)
func RegisterEmail(group *gin.RouterGroup, h *handler.Email) {
email := group.Group("/email")
email.POST("/emailTest", h.Test)
email.POST("/sendEmail", h.Send)
}
+21
View File
@@ -0,0 +1,21 @@
package router
import (
"kra/internal/server/handler"
"github.com/gin-gonic/gin"
)
func RegisterMenu(group *gin.RouterGroup, h *handler.Menu) {
router := group.Group("/menu")
router.POST("/getMenuList", h.List)
router.POST("/getBaseMenuTree", h.Tree)
router.POST("/addBaseMenu", h.Create)
router.POST("/updateBaseMenu", h.Update)
router.POST("/deleteBaseMenu", h.Delete)
router.POST("/getBaseMenuById", h.Find)
router.POST("/addMenuAuthority", h.SetAuthorityMenus)
router.POST("/getMenuAuthority", h.AuthorityMenus)
router.GET("/getMenuRoles", h.RoleIDs)
router.POST("/setMenuRoles", h.SetRoles)
}
+29
View File
@@ -0,0 +1,29 @@
package router
import (
"kra/internal/server/handler"
"github.com/gin-gonic/gin"
)
func RegisterOrganization(group *gin.RouterGroup, h *handler.Organization) {
departments := group.Group("/department")
departments.POST("/getDepartmentList", h.ListDepartments)
departments.POST("/createDepartment", h.CreateDepartment)
departments.PUT("/updateDepartment", h.UpdateDepartment)
departments.DELETE("/deleteDepartment", h.DeleteDepartment)
departments.GET("/findDepartment", h.FindDepartment)
departments.GET("/getDepartmentUsers", h.DepartmentUsers)
departments.POST("/setDepartmentUsers", h.SetDepartmentUsers)
group.POST("/user/setUserDepartments", h.SetUserDepartments)
positions := group.Group("/position")
positions.POST("/getPositionList", h.ListPositions)
positions.POST("/createPosition", h.CreatePosition)
positions.PUT("/updatePosition", h.UpdatePosition)
positions.DELETE("/deletePosition", h.DeletePosition)
positions.GET("/findPosition", h.FindPosition)
positions.GET("/getPositionUsers", h.PositionUsers)
positions.POST("/setPositionUsers", h.SetPositionUsers)
group.POST("/user/setUserPositions", h.SetUserPositions)
}
+14
View File
@@ -0,0 +1,14 @@
package router
import (
"kra/internal/server/handler"
"github.com/gin-gonic/gin"
)
func RegisterPermission(group *gin.RouterGroup, h *handler.Permission) {
buttons := group.Group("/authorityBtn")
buttons.POST("/getAuthorityBtn", h.Buttons)
buttons.POST("/setAuthorityBtn", h.SetButtons)
buttons.POST("/canRemoveAuthorityBtn", h.CanRemoveButton)
}
+20
View File
@@ -0,0 +1,20 @@
package router
import (
"kra/internal/server/handler"
"github.com/gin-gonic/gin"
)
func RegisterTask(group *gin.RouterGroup, h *handler.Task) {
router := group.Group("/timedTask")
router.POST("/createTimedTask", h.Create)
router.PUT("/updateTimedTask", h.Update)
router.DELETE("/deleteTimedTask", h.Delete)
router.POST("/toggleTimedTask", h.Toggle)
router.POST("/triggerTimedTask", h.Trigger)
router.GET("/getTimedTaskList", h.List)
router.GET("/getTimedTaskLogList", h.Logs)
router.GET("/getRegisteredMethods", h.Methods)
router.GET("/alertStream", h.AlertStream)
}