优化结构
This commit is contained in:
@@ -2,10 +2,10 @@ package system
|
||||
|
||||
import (
|
||||
"context"
|
||||
"kra/internal/biz/system"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"kra/internal/biz"
|
||||
platformmodule "kra/pkg/module"
|
||||
|
||||
"github.com/google/uuid"
|
||||
@@ -13,14 +13,14 @@ import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func SeedSystem(ctx context.Context, db *gorm.DB, input *biz.DatabaseConfig, surfaces ...platformmodule.Surface) error {
|
||||
func SeedSystem(ctx context.Context, db *gorm.DB, input *system.DatabaseConfig, surfaces ...platformmodule.Surface) error {
|
||||
return seedSystem(ctx, db, input, nil, surfaces...)
|
||||
}
|
||||
|
||||
// SeedSystemWithCatalog applies module-contributed administration surfaces and
|
||||
// default timed tasks in one transaction. The system module remains the owner
|
||||
// of the system tables, while other modules contribute through the catalog.
|
||||
func SeedSystemWithCatalog(ctx context.Context, db *gorm.DB, input *biz.DatabaseConfig, catalog platformmodule.Catalog) error {
|
||||
func SeedSystemWithCatalog(ctx context.Context, db *gorm.DB, input *system.DatabaseConfig, catalog platformmodule.Catalog) error {
|
||||
surfaces := make([]platformmodule.Surface, 0, len(catalog.Definitions))
|
||||
for _, definition := range catalog.Definitions {
|
||||
surfaces = append(surfaces, definition.Surface)
|
||||
@@ -28,7 +28,7 @@ func SeedSystemWithCatalog(ctx context.Context, db *gorm.DB, input *biz.Database
|
||||
return seedSystem(ctx, db, input, catalog.DefaultTimedTasks(), surfaces...)
|
||||
}
|
||||
|
||||
func seedSystem(ctx context.Context, db *gorm.DB, input *biz.DatabaseConfig, defaults []platformmodule.TimedTask, surfaces ...platformmodule.Surface) error {
|
||||
func seedSystem(ctx context.Context, db *gorm.DB, input *system.DatabaseConfig, defaults []platformmodule.TimedTask, surfaces ...platformmodule.Surface) error {
|
||||
return db.WithContext(ctx).Transaction(func(tx *gorm.DB) error {
|
||||
rootParentID := uint(0)
|
||||
authority := authorityPO{AuthorityID: 888, AuthorityName: "超级管理员", ParentID: &rootParentID, DataScope: 1, DefaultRouter: "dashboard"}
|
||||
|
||||
Reference in New Issue
Block a user