41 lines
1.6 KiB
Go
41 lines
1.6 KiB
Go
// Package system contains the built-in system module contribution to the
|
|
// application catalog.
|
|
package system
|
|
|
|
import (
|
|
"strings"
|
|
|
|
datasystem "kra/internal/data/repository"
|
|
"kra/internal/routecatalog"
|
|
"kra/pkg/module"
|
|
)
|
|
|
|
// Definition describes the built-in system contribution to the application
|
|
// catalog. Other business modules can expose the same shape independently.
|
|
func Definition() module.Definition {
|
|
communication := module.Surface{
|
|
Menus: []module.Menu{{Name: "integrationConfig", Path: "integrationConfig", ParentName: "extensions", Component: "view/systemTools/integration/config.vue", Title: "通信集成", Icon: "connection", Sort: 8}},
|
|
APIs: integrationAPIs(),
|
|
}
|
|
return module.Definition{
|
|
Name: "system",
|
|
Migrations: datasystem.Migrations(),
|
|
Surface: communication,
|
|
TimedTasks: []module.TimedTask{
|
|
{Name: "ClearDB", Description: "定时清理数据库过期日志(操作记录/JWT黑名单/定时任务执行日志)", Spec: "@daily", MethodName: "ClearDB", Enabled: true},
|
|
{Name: "CleanStaleUploads", Description: "定时清理过期大文件上传会话", Spec: "@hourly", MethodName: "CleanStaleUploads", Enabled: true},
|
|
},
|
|
}
|
|
}
|
|
|
|
func integrationAPIs() []module.API {
|
|
items := make([]module.API, 0, 5)
|
|
for _, descriptor := range routecatalog.Descriptors() {
|
|
if descriptor.Public || !strings.HasPrefix(descriptor.Path, "/integration/configs") || descriptor.Description == "" {
|
|
continue
|
|
}
|
|
items = append(items, module.API{Path: descriptor.Path, Method: descriptor.Method, Group: descriptor.Group, Description: descriptor.Description})
|
|
}
|
|
return items
|
|
}
|