refactor: separate backend domains and storage adapters

This commit is contained in:
2026-08-14 01:37:56 +08:00
parent e6775f0966
commit 8c4c6ba661
102 changed files with 6644 additions and 5735 deletions
+14
View File
@@ -0,0 +1,14 @@
package router
import (
"kra/internal/server/handler"
"github.com/gin-gonic/gin"
)
func RegisterAPIToken(group *gin.RouterGroup, handler *handler.APIToken) {
router := group.Group("/sysApiToken")
router.POST("/createApiToken", handler.Create)
router.POST("/getApiTokenList", handler.List)
router.POST("/deleteApiToken", handler.Delete)
}
+34
View File
@@ -0,0 +1,34 @@
package router
import (
"kra/internal/server/handler"
"github.com/gin-gonic/gin"
)
func RegisterAudit(group, public *gin.RouterGroup, h *handler.Audit) {
operations := group.Group("/sysOperationRecord")
operations.GET("/getSysOperationRecordList", h.Operations)
operations.GET("/findSysOperationRecord", h.Operation)
operations.DELETE("/deleteSysOperationRecord", h.DeleteOperation)
operations.DELETE("/deleteSysOperationRecordByIds", h.DeleteOperations)
logins := group.Group("/sysLoginLog")
logins.GET("/getLoginLogList", h.Logins)
logins.GET("/findLoginLog", h.Login)
logins.DELETE("/deleteLoginLog", h.DeleteLogin)
logins.DELETE("/deleteLoginLogByIds", h.DeleteLogins)
access := group.Group("/dataAccessLog")
access.POST("/getDataAccessLogList", h.DataAccess)
access.DELETE("/deleteDataAccessLogByIds", h.DeleteDataAccess)
viewer := group.Group("/logViewer")
viewer.GET("/dates", h.LogDates)
viewer.GET("/files", h.LogFiles)
viewer.GET("/content", h.LogContent)
errors := group.Group("/sysError")
errors.DELETE("/deleteSysError", h.DeleteError)
errors.DELETE("/deleteSysErrorByIds", h.DeleteErrors)
errors.PUT("/updateSysError", h.UpdateError)
errors.GET("/findSysError", h.Error)
errors.GET("/getSysErrorList", h.Errors)
public.Group("/sysError").POST("/createSysError", h.CreateError)
}
+29
View File
@@ -0,0 +1,29 @@
package router
import (
"kra/internal/server/handler"
"github.com/gin-gonic/gin"
)
func RegisterDictionary(group *gin.RouterGroup, h *handler.Dictionary) {
dictionaries := group.Group("/sysDictionary")
dictionaries.POST("/createSysDictionary", h.Create)
dictionaries.PUT("/updateSysDictionary", h.Update)
dictionaries.DELETE("/deleteSysDictionary", h.Delete)
dictionaries.GET("/findSysDictionary", h.Find)
dictionaries.GET("/getSysDictionaryList", h.List(false))
dictionaries.GET("/getSysDictionaryListWithDetails", h.List(true))
dictionaries.GET("/exportSysDictionary", h.Export)
dictionaries.POST("/importSysDictionary", h.Import)
details := group.Group("/sysDictionaryDetail")
details.POST("/createSysDictionaryDetail", h.CreateDetail)
details.PUT("/updateSysDictionaryDetail", h.UpdateDetail)
details.DELETE("/deleteSysDictionaryDetail", h.DeleteDetail)
details.GET("/findSysDictionaryDetail", h.FindDetail)
details.GET("/getSysDictionaryDetailList", h.Details)
details.GET("/getDictionaryTreeList", h.Tree(false))
details.GET("/getDictionaryTreeListByType", h.Tree(true))
details.GET("/getDictionaryDetailsByParent", h.DetailsByParent)
details.GET("/getDictionaryPath", h.Path)
}
+24
View File
@@ -0,0 +1,24 @@
package router
import (
"kra/internal/server/handler"
"github.com/gin-gonic/gin"
)
func RegisterExport(group, public *gin.RouterGroup, h *handler.Export) {
router := group.Group("/sysExportTemplate")
router.POST("/createSysExportTemplate", h.Create)
router.PUT("/updateSysExportTemplate", h.Update)
router.DELETE("/deleteSysExportTemplate", h.Delete)
router.DELETE("/deleteSysExportTemplateByIds", h.DeleteMany)
router.GET("/findSysExportTemplate", h.Find)
router.GET("/getSysExportTemplateList", h.List)
router.GET("/previewSQL", h.Preview)
router.GET("/exportExcel", h.Issue(false))
router.GET("/exportTemplate", h.Issue(true))
router.POST("/importExcel", h.Import)
pub := public.Group("/sysExportTemplate")
pub.GET("/exportExcelByToken", h.Download(false))
pub.GET("/exportTemplateByToken", h.Download(true))
}
+28
View File
@@ -0,0 +1,28 @@
package router
import (
"kra/internal/server/handler"
"github.com/gin-gonic/gin"
)
func RegisterMedia(group *gin.RouterGroup, h *handler.Media) {
files := group.Group("/fileUploadAndDownload")
files.POST("/upload", h.Upload)
files.POST("/getFileList", h.List)
files.POST("/deleteFile", h.Delete)
files.POST("/deleteFiles", h.DeleteMany)
files.GET("/findFile", h.Find)
files.POST("/editFileName", h.Rename)
files.POST("/importURL", h.ImportURLs)
files.POST("/listOssFiles", h.Storage)
categories := group.Group("/attachmentCategory")
categories.GET("/getCategoryList", h.Categories)
categories.POST("/addCategory", h.SaveCategory)
categories.POST("/deleteCategory", h.DeleteCategory)
upload := group.Group("/mediaUpload")
upload.POST("/init", h.InitUpload)
upload.POST("/chunk", h.SaveChunk)
upload.POST("/complete", h.CompleteUpload)
upload.DELETE("/:uploadId", h.CancelUpload)
}
+18
View File
@@ -0,0 +1,18 @@
package router
import (
"kra/internal/server/handler"
"github.com/gin-gonic/gin"
)
func RegisterParameter(group *gin.RouterGroup, handler *handler.Parameter) {
router := group.Group("/sysParams")
router.POST("/createSysParams", handler.Create)
router.PUT("/updateSysParams", handler.Update)
router.DELETE("/deleteSysParams", handler.Delete)
router.DELETE("/deleteSysParamsByIds", handler.DeleteMany)
router.GET("/findSysParams", handler.Find)
router.GET("/getSysParam", handler.Get)
router.GET("/getSysParamsList", handler.List)
}
+16
View File
@@ -0,0 +1,16 @@
package router
import (
"kra/internal/server/handler"
"github.com/gin-gonic/gin"
)
func RegisterPublic(group *gin.RouterGroup, engine *gin.Engine, handler *handler.Public) {
base := group.Group("/base")
base.POST("/captcha", handler.Captcha)
base.POST("/login", handler.Login)
init := group.Group("/init")
init.POST("/checkdb", handler.CheckDatabase)
init.POST("/initdb", handler.InitializeDatabase(engine))
}
+19
View File
@@ -0,0 +1,19 @@
package router
import (
"kra/internal/server/handler"
"github.com/gin-gonic/gin"
)
func RegisterSystemConfig(group *gin.RouterGroup, handler *handler.SystemConfig) {
security := group.Group("/securityConfig")
security.GET("/getSecurityConfig", handler.GetSecurity)
security.POST("/setSecurityConfig", handler.SetSecurity)
system := group.Group("/system")
system.POST("/getSystemConfig", handler.Get)
system.POST("/setSystemConfig", handler.Set)
system.POST("/reloadSystem", handler.Reload)
system.POST("/getServerInfo", handler.ServerInfo)
}
+30
View File
@@ -0,0 +1,30 @@
package router
import (
"kra/internal/server/handler"
"github.com/gin-gonic/gin"
)
func RegisterUser(group *gin.RouterGroup, handler *handler.User) {
user := group.Group("/user")
user.POST("/getUserList", handler.List)
user.POST("/admin_register", handler.Create)
user.PUT("/setUserInfo", handler.Update)
user.PUT("/setSelfInfo", handler.UpdateSelf)
user.DELETE("/deleteUser", handler.Delete)
user.POST("/resetPassword", handler.ResetPassword)
user.POST("/changePassword", handler.ChangePassword)
user.PUT("/setSelfSetting", handler.SetSelfSetting)
user.POST("/setUserAuthorities", handler.SetAuthorities)
user.POST("/setUserAuthority", handler.SwitchAuthority)
user.GET("/getUserInfo", handler.Get)
}
func RegisterNavigation(group *gin.RouterGroup, handler *handler.Navigation) {
group.Group("/menu").POST("/getMenu", handler.Menu)
}
func RegisterSession(group *gin.RouterGroup, handler *handler.Session) {
group.Group("/jwt").POST("/jsonInBlacklist", handler.Logout)
}
+18
View File
@@ -0,0 +1,18 @@
package router
import (
"kra/internal/server/handler"
"github.com/gin-gonic/gin"
)
func RegisterVersion(group *gin.RouterGroup, h *handler.Version) {
router := group.Group("/sysVersion")
router.DELETE("/deleteSysVersion", h.Delete)
router.DELETE("/deleteSysVersionByIds", h.DeleteMany)
router.GET("/findSysVersion", h.Find)
router.GET("/getSysVersionList", h.List)
router.POST("/exportVersion", h.Export)
router.GET("/downloadVersionJson", h.Download)
router.POST("/importVersion", h.Import)
}