优化
This commit is contained in:
@@ -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})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user