This commit is contained in:
Yvan
2026-08-17 15:23:57 +08:00
parent 05b49cd86a
commit 083cc3a9ea
24 changed files with 639 additions and 287 deletions
+1 -8
View File
@@ -2,7 +2,6 @@ package service
import (
"context"
"strings"
"kra/internal/biz"
"kra/internal/routeinfo"
@@ -29,13 +28,7 @@ func (s *SystemConfigService) Initialize(ctx context.Context, input *dto.Databas
func (s *SystemConfigService) InitializeRoutes(ctx context.Context, input *dto.DatabaseInitRequest, routes []dto.Route) error {
apis := make([]*biz.API, 0, len(routes))
for _, route := range routes {
path := route.Path
if routerPrefix := s.settings.RouterPrefix(); routerPrefix != "" {
path = strings.TrimPrefix(path, strings.TrimSuffix(routerPrefix, "/"))
if path == "" {
path = "/"
}
}
path := NormalizeRoutePath(route.Path, s.settings.RouterPrefix())
group, description := routeinfo.Metadata(route.Method, path)
apis = append(apis, &biz.API{Path: path, Method: route.Method, APIGroup: group, Description: description})
}