diff --git a/cmd/kratos-admin/main.go b/cmd/kratos-admin/main.go index cbb2bff..ea39c0c 100644 --- a/cmd/kratos-admin/main.go +++ b/cmd/kratos-admin/main.go @@ -11,9 +11,9 @@ import ( "kra/internal/conf" "kra/internal/logging" - "kra/internal/service" - "kra/internal/service/dto" - "kra/internal/worker" + "kra/internal/modules/system/dto" + "kra/internal/modules/system/service" + "kra/internal/modules/system/worker" "github.com/go-kratos/kratos/v3" "github.com/go-kratos/kratos/v3/config" diff --git a/cmd/kratos-admin/wire.go b/cmd/kratos-admin/wire.go index 0f31f9f..e3df191 100644 --- a/cmd/kratos-admin/wire.go +++ b/cmd/kratos-admin/wire.go @@ -8,16 +8,16 @@ package main import ( "log/slog" - "kra/internal/biz" "kra/internal/conf" - "kra/internal/data" - "kra/internal/initialize" - "kra/internal/integration" - "kra/internal/integration/cache" "kra/internal/logging" - "kra/internal/server" - "kra/internal/service" - "kra/internal/worker" + "kra/internal/modules/system/biz" + "kra/internal/modules/system/data" + "kra/internal/modules/system/initialize" + "kra/internal/modules/system/integration" + "kra/internal/modules/system/integration/cache" + "kra/internal/modules/system/service" + "kra/internal/modules/system/transport/server" + "kra/internal/modules/system/worker" "github.com/go-kratos/kratos/v3" "github.com/google/wire" diff --git a/cmd/kratos-admin/wire_gen.go b/cmd/kratos-admin/wire_gen.go index 7c4cc06..eb6c3cd 100644 --- a/cmd/kratos-admin/wire_gen.go +++ b/cmd/kratos-admin/wire_gen.go @@ -8,20 +8,20 @@ package main import ( "github.com/go-kratos/kratos/v3" - "kra/internal/biz" "kra/internal/conf" - "kra/internal/data" - "kra/internal/data/payment" - "kra/internal/data/system" - "kra/internal/initialize" - "kra/internal/integration/cache" - "kra/internal/integration/email" - "kra/internal/integration/storage" "kra/internal/logging" - "kra/internal/server" - "kra/internal/server/handler" - "kra/internal/service" - "kra/internal/worker" + "kra/internal/modules/system/biz" + "kra/internal/modules/system/data" + "kra/internal/modules/system/data/payment" + "kra/internal/modules/system/data/repository" + "kra/internal/modules/system/initialize" + "kra/internal/modules/system/integration/cache" + "kra/internal/modules/system/integration/email" + "kra/internal/modules/system/integration/storage" + "kra/internal/modules/system/service" + "kra/internal/modules/system/transport/handler" + "kra/internal/modules/system/transport/server" + "kra/internal/modules/system/worker" "log/slog" ) diff --git a/go.mod b/go.mod index 5998625..9d5221e 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,6 @@ require ( github.com/fsnotify/fsnotify v1.10.1 github.com/gin-gonic/gin v1.10.0 github.com/glebarez/sqlite v1.11.0 - github.com/go-gormigrate/gormigrate/v2 v2.1.6 github.com/go-kratos/kratos/contrib/otel/v3 v3.0.0-20260617100506-4e232a3eff59 github.com/go-kratos/kratos/v3 v3.0.0 github.com/go-pay/crypto v0.0.1 diff --git a/go.sum b/go.sum index 158199b..740089b 100644 --- a/go.sum +++ b/go.sum @@ -126,8 +126,6 @@ github.com/glebarez/go-sqlite v1.21.2 h1:3a6LFC4sKahUunAmynQKLZceZCOzUthkRkEAl9g github.com/glebarez/go-sqlite v1.21.2/go.mod h1:sfxdZyhQjTM2Wry3gVYWaW072Ri1WMdWJi0k6+3382k= github.com/glebarez/sqlite v1.11.0 h1:wSG0irqzP6VurnMEpFGer5Li19RpIRi2qvQz++w0GMw= github.com/glebarez/sqlite v1.11.0/go.mod h1:h8/o8j5wiAsqSPoWELDUdJXhjAhsVliSn7bWZjOhrgQ= -github.com/go-gormigrate/gormigrate/v2 v2.1.6 h1:VtX+l1Stj2v5RGubVQk0LS/8EPGXR+ldcOyCmlmKoyg= -github.com/go-gormigrate/gormigrate/v2 v2.1.6/go.mod h1:PZpedQc4tWaxn6kvXicwhinh3L0seLpMc5ReKRX5id4= github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A= github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= github.com/go-kratos/kratos/contrib/otel/v3 v3.0.0-20260617100506-4e232a3eff59 h1:FeDujUZF6a2pPS0RWGI52IXWPqVcGW1QP5vHDlAqLE8= diff --git a/internal/biz/README.md b/internal/biz/README.md deleted file mode 100644 index 97a06f5..0000000 --- a/internal/biz/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Biz - -本目录只包含领域对象、用例和仓储接口,不依赖 HTTP Handler、数据库驱动或对象存储 SDK。跨多表、必须原子完成的业务动作通过具有业务含义的仓储方法表达。 diff --git a/internal/data/README.md b/internal/data/README.md deleted file mode 100644 index 3e56032..0000000 --- a/internal/data/README.md +++ /dev/null @@ -1,53 +0,0 @@ -# Data Layer - -`internal/data` is the persistence composition root. It owns the shared -database/runtime container (`Data`), database clients, configuration storage, -and the Wire `ProviderSet`. Business repositories live in submodules so a new -feature can be found by its domain instead of by scanning one large package. - -## Modules - -- `internal/data/system` contains the built-in administration domain: users, - authorities, APIs, permissions, menus, organization, dictionaries, - parameters, tokens, security, audit/logging, media, announcements, tasks, - versions, exports, bootstrap seeding, and system migrations. -- `internal/data/payment` contains payment configuration and payment-order - persistence. Provider SDK implementations are separate in - `internal/integration/payment`. -- `internal/data/migration` contains the version-table runner used by the - root migration coordinator. It stays under data because it executes and - records database schema steps. -- `internal/adminsurface` contains the small menu/API metadata contract used - when a business module contributes pages to the administration UI. It lives - outside `data` because the contract itself is not persistence code. - -The root package intentionally keeps only cross-cutting infrastructure: -database lifecycle/reloads, runtime configuration persistence, data-scope -auditing, integration configuration storage, and migration orchestration. -Repositories depend on narrow module seams (`system.Provider` and -`payment.Provider`) rather than importing the root implementation details. - -First-install and configuration-management orchestration lives in -`internal/initialize`. It implements `biz.InitializationRepo` through a narrow -backend interface that `*data.Data` satisfies. This keeps administrator/menu/API -seeding out of the database lifecycle package while retaining one migration -entry point. - -Non-database adapters remain under `internal/integration` (storage, email, -payment SDKs, and cache). Their constructors are provided by -`internal/integration.ProviderSet`, separate from the data provider set. -GORM and pagination helpers live beside the data layer; stateless payment -parsing lives in `internal/utils/paymentutil`; admin JWT handling lives in -`internal/security/adminauth`. - -## Migration and bootstrap - -There is one migration execution entry point: `migrateAll` in the root data -package. The root owns the shared integration-configuration table and appends -the steps returned by `system.Migrations()` and `payment.Migrations()`. - -Migrations create schemas and module-required fixed records only. Initial -business data is separate: `initialize.Repo` invokes `system.SeedSystem` only -from the explicit first-install flow to create the administrator, roles, -menus, APIs, departments, policies, and module-provided administration -surfaces. diff --git a/internal/data/migration/runner.go b/internal/data/migration/runner.go deleted file mode 100644 index 0e12f08..0000000 --- a/internal/data/migration/runner.go +++ /dev/null @@ -1,40 +0,0 @@ -// Package migration owns the application database migration runner. Each data -// module declares its own steps; the root data package only orders and runs -// them. -package migration - -import ( - "fmt" - - "github.com/go-gormigrate/gormigrate/v2" - "gorm.io/gorm" -) - -const TableName = "sys_schema_migrations" - -type Step struct { - ID string - Migrate func(*gorm.DB) error -} - -func Run(db *gorm.DB, steps []Step) error { - if db == nil { - return fmt.Errorf("database is nil") - } - migrations := make([]*gormigrate.Migration, 0, len(steps)) - for _, step := range steps { - current := step - migrations = append(migrations, &gormigrate.Migration{ID: current.ID, Migrate: current.Migrate}) - } - manager := gormigrate.New(db, &gormigrate.Options{ - TableName: TableName, - IDColumnName: "id", - IDColumnSize: 255, - UseTransaction: false, - ValidateUnknownMigrations: true, - }, migrations) - if err := manager.Migrate(); err != nil { - return fmt.Errorf("apply database migrations: %w", err) - } - return nil -} diff --git a/internal/initialize/README.md b/internal/initialize/README.md deleted file mode 100644 index a43626c..0000000 --- a/internal/initialize/README.md +++ /dev/null @@ -1,22 +0,0 @@ -# Initialization - -`internal/initialize` owns application bootstrap orchestration. It implements -`biz.InitializationRepo`, coordinates the explicit first-install workflow, and -formats the compatible runtime configuration API. - -The package depends on a narrow `Backend` interface. `*data.Data` implements -that interface and remains responsible for opening, migrating, activating, -reloading, and persisting database-backed runtime infrastructure. - -The first-install order is: - -1. `data` opens the candidate database. -2. The single root migration runner applies infrastructure, system, and - payment schema steps. -3. `initialize` invokes `system.SeedSystem` for administrator, menu, API, - department, policy, and module administration-surface records. -4. `data` persists configuration and activates the candidate clients. - -Schema migration and business seed data are deliberately separate. Normal -startup and configuration reload may run migrations, but only the explicit -first-install endpoint runs seed data. diff --git a/internal/logging/zap_test.go b/internal/logging/zap_test.go index 1804cdb..42e076f 100644 --- a/internal/logging/zap_test.go +++ b/internal/logging/zap_test.go @@ -89,7 +89,7 @@ func TestErrorEntryIncludesFinalApplicationSource(t *testing.T) { if err := os.WriteFile(filename, []byte(content), 0o600); err != nil { t.Fatal(err) } - entry := errorEntryFromZap(zapcore.Entry{Message: "task failed", Level: zapcore.ErrorLevel, Stack: "kra/internal/worker.execute\n" + filename + ":4"}, nil) + entry := errorEntryFromZap(zapcore.Entry{Message: "task failed", Level: zapcore.ErrorLevel, Stack: "kra/internal/modules/system/worker.execute\n" + filename + ":4"}, nil) if !strings.Contains(entry.Info, "最终调用方法:"+filename+":4 (execute lines 3-5)") || !strings.Contains(entry.Info, "func execute()") { t.Fatalf("expected final caller source in error entry: %s", entry.Info) } diff --git a/internal/modules/README.md b/internal/modules/README.md new file mode 100644 index 0000000..ef8e86d --- /dev/null +++ b/internal/modules/README.md @@ -0,0 +1,16 @@ +# Internal Modules + +业务代码按模块组织在 `internal/modules/` 下。每个模块可以拥有自己的 +`biz`、`data`、`service` 和 `transport`,模块之间通过接口和集成层协作。 + +## 当前模块 + +`system` 是模板自带的后台管理模块,包含用户、权限、菜单、API、公告、部门、 +字典、文件、审计、定时任务、支付和系统初始化等现有表与逻辑。 + +## 新增业务模块 + +新增业务请创建 `internal/modules/`,不要把领域模型、仓储或 HTTP +处理器继续添加到 `internal/biz`、`internal/data`、`internal/service` 等根目录。 +数据库表和迁移由业务模块自己的 `data` 包负责;只有数据库连接生命周期和通用 +迁移执行器属于 `internal/platform/database`。 diff --git a/internal/modules/system/README.md b/internal/modules/system/README.md new file mode 100644 index 0000000..8be54b6 --- /dev/null +++ b/internal/modules/system/README.md @@ -0,0 +1,16 @@ +# System Module + +系统模块承载当前管理后台的完整业务边界: + +- `biz`:系统领域对象、用例和仓储接口 +- `data`:数据库生命周期、系统仓储、系统表和支付持久化 +- `service`:请求 DTO 与领域用例的转换 +- `transport`:Gin server、middleware、handler、router、HTTP 响应工具 +- `integration`:Redis、邮件、对象存储和支付渠道适配器 +- `initialize`:数据库首次初始化和系统种子数据编排 +- `worker`:定时任务执行与调度 +- `security`:后台 JWT 等安全实现 +- `utils`:只服务于系统模块的无状态工具 + +系统表统一使用 `sys_` 前缀;业务表应由新业务模块自行命名和迁移,不要混入 +本目录。 diff --git a/internal/adminsurface/surface.go b/internal/modules/system/adminsurface/surface.go similarity index 100% rename from internal/adminsurface/surface.go rename to internal/modules/system/adminsurface/surface.go diff --git a/internal/biz/access_control.go b/internal/modules/system/biz/access_control.go similarity index 100% rename from internal/biz/access_control.go rename to internal/modules/system/biz/access_control.go diff --git a/internal/biz/actor.go b/internal/modules/system/biz/actor.go similarity index 100% rename from internal/biz/actor.go rename to internal/modules/system/biz/actor.go diff --git a/internal/biz/announcement.go b/internal/modules/system/biz/announcement.go similarity index 100% rename from internal/biz/announcement.go rename to internal/modules/system/biz/announcement.go diff --git a/internal/biz/api.go b/internal/modules/system/biz/api.go similarity index 100% rename from internal/biz/api.go rename to internal/modules/system/biz/api.go diff --git a/internal/biz/api_token.go b/internal/modules/system/biz/api_token.go similarity index 100% rename from internal/biz/api_token.go rename to internal/modules/system/biz/api_token.go diff --git a/internal/biz/audit.go b/internal/modules/system/biz/audit.go similarity index 100% rename from internal/biz/audit.go rename to internal/modules/system/biz/audit.go diff --git a/internal/biz/authentication.go b/internal/modules/system/biz/authentication.go similarity index 100% rename from internal/biz/authentication.go rename to internal/modules/system/biz/authentication.go diff --git a/internal/biz/authentication_test.go b/internal/modules/system/biz/authentication_test.go similarity index 100% rename from internal/biz/authentication_test.go rename to internal/modules/system/biz/authentication_test.go diff --git a/internal/biz/authority.go b/internal/modules/system/biz/authority.go similarity index 100% rename from internal/biz/authority.go rename to internal/modules/system/biz/authority.go diff --git a/internal/biz/biz.go b/internal/modules/system/biz/biz.go similarity index 100% rename from internal/biz/biz.go rename to internal/modules/system/biz/biz.go diff --git a/internal/biz/data_scope.go b/internal/modules/system/biz/data_scope.go similarity index 100% rename from internal/biz/data_scope.go rename to internal/modules/system/biz/data_scope.go diff --git a/internal/biz/department.go b/internal/modules/system/biz/department.go similarity index 100% rename from internal/biz/department.go rename to internal/modules/system/biz/department.go diff --git a/internal/biz/dictionary.go b/internal/modules/system/biz/dictionary.go similarity index 100% rename from internal/biz/dictionary.go rename to internal/modules/system/biz/dictionary.go diff --git a/internal/biz/email.go b/internal/modules/system/biz/email.go similarity index 100% rename from internal/biz/email.go rename to internal/modules/system/biz/email.go diff --git a/internal/biz/errors.go b/internal/modules/system/biz/errors.go similarity index 100% rename from internal/biz/errors.go rename to internal/modules/system/biz/errors.go diff --git a/internal/biz/export.go b/internal/modules/system/biz/export.go similarity index 100% rename from internal/biz/export.go rename to internal/modules/system/biz/export.go diff --git a/internal/biz/infrastructure.go b/internal/modules/system/biz/infrastructure.go similarity index 100% rename from internal/biz/infrastructure.go rename to internal/modules/system/biz/infrastructure.go diff --git a/internal/biz/media.go b/internal/modules/system/biz/media.go similarity index 100% rename from internal/biz/media.go rename to internal/modules/system/biz/media.go diff --git a/internal/biz/media_metadata.go b/internal/modules/system/biz/media_metadata.go similarity index 100% rename from internal/biz/media_metadata.go rename to internal/modules/system/biz/media_metadata.go diff --git a/internal/biz/media_test.go b/internal/modules/system/biz/media_test.go similarity index 100% rename from internal/biz/media_test.go rename to internal/modules/system/biz/media_test.go diff --git a/internal/biz/media_upload.go b/internal/modules/system/biz/media_upload.go similarity index 100% rename from internal/biz/media_upload.go rename to internal/modules/system/biz/media_upload.go diff --git a/internal/biz/menu.go b/internal/modules/system/biz/menu.go similarity index 100% rename from internal/biz/menu.go rename to internal/modules/system/biz/menu.go diff --git a/internal/biz/pagination.go b/internal/modules/system/biz/pagination.go similarity index 100% rename from internal/biz/pagination.go rename to internal/modules/system/biz/pagination.go diff --git a/internal/biz/parameter.go b/internal/modules/system/biz/parameter.go similarity index 100% rename from internal/biz/parameter.go rename to internal/modules/system/biz/parameter.go diff --git a/internal/biz/payment.go b/internal/modules/system/biz/payment.go similarity index 100% rename from internal/biz/payment.go rename to internal/modules/system/biz/payment.go diff --git a/internal/biz/payment_log.go b/internal/modules/system/biz/payment_log.go similarity index 100% rename from internal/biz/payment_log.go rename to internal/modules/system/biz/payment_log.go diff --git a/internal/biz/payment_order.go b/internal/modules/system/biz/payment_order.go similarity index 100% rename from internal/biz/payment_order.go rename to internal/modules/system/biz/payment_order.go diff --git a/internal/biz/payment_test.go b/internal/modules/system/biz/payment_test.go similarity index 100% rename from internal/biz/payment_test.go rename to internal/modules/system/biz/payment_test.go diff --git a/internal/biz/permission.go b/internal/modules/system/biz/permission.go similarity index 100% rename from internal/biz/permission.go rename to internal/modules/system/biz/permission.go diff --git a/internal/biz/position.go b/internal/modules/system/biz/position.go similarity index 100% rename from internal/biz/position.go rename to internal/modules/system/biz/position.go diff --git a/internal/biz/security.go b/internal/modules/system/biz/security.go similarity index 100% rename from internal/biz/security.go rename to internal/modules/system/biz/security.go diff --git a/internal/biz/security_test.go b/internal/modules/system/biz/security_test.go similarity index 100% rename from internal/biz/security_test.go rename to internal/modules/system/biz/security_test.go diff --git a/internal/biz/system_init.go b/internal/modules/system/biz/system_init.go similarity index 100% rename from internal/biz/system_init.go rename to internal/modules/system/biz/system_init.go diff --git a/internal/biz/task.go b/internal/modules/system/biz/task.go similarity index 100% rename from internal/biz/task.go rename to internal/modules/system/biz/task.go diff --git a/internal/biz/task_registry.go b/internal/modules/system/biz/task_registry.go similarity index 100% rename from internal/biz/task_registry.go rename to internal/modules/system/biz/task_registry.go diff --git a/internal/biz/task_test.go b/internal/modules/system/biz/task_test.go similarity index 100% rename from internal/biz/task_test.go rename to internal/modules/system/biz/task_test.go diff --git a/internal/biz/upload_session.go b/internal/modules/system/biz/upload_session.go similarity index 100% rename from internal/biz/upload_session.go rename to internal/modules/system/biz/upload_session.go diff --git a/internal/biz/user.go b/internal/modules/system/biz/user.go similarity index 100% rename from internal/biz/user.go rename to internal/modules/system/biz/user.go diff --git a/internal/biz/user_test.go b/internal/modules/system/biz/user_test.go similarity index 100% rename from internal/biz/user_test.go rename to internal/modules/system/biz/user_test.go diff --git a/internal/biz/version.go b/internal/modules/system/biz/version.go similarity index 100% rename from internal/biz/version.go rename to internal/modules/system/biz/version.go diff --git a/internal/data/config_helpers.go b/internal/modules/system/data/config_helpers.go similarity index 100% rename from internal/data/config_helpers.go rename to internal/modules/system/data/config_helpers.go diff --git a/internal/data/config_store.go b/internal/modules/system/data/config_store.go similarity index 99% rename from internal/data/config_store.go rename to internal/modules/system/data/config_store.go index 0b48402..6ac18eb 100644 --- a/internal/data/config_store.go +++ b/internal/modules/system/data/config_store.go @@ -10,7 +10,7 @@ import ( "strconv" "kra/internal/conf" - "kra/internal/integration/storage" + "kra/internal/modules/system/integration/storage" "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/proto" diff --git a/internal/data/config_watch.go b/internal/modules/system/data/config_watch.go similarity index 100% rename from internal/data/config_watch.go rename to internal/modules/system/data/config_watch.go diff --git a/internal/data/data.go b/internal/modules/system/data/data.go similarity index 98% rename from internal/data/data.go rename to internal/modules/system/data/data.go index 9df079e..db636d7 100644 --- a/internal/data/data.go +++ b/internal/modules/system/data/data.go @@ -12,9 +12,9 @@ import ( "github.com/redis/go-redis/v9" "gorm.io/gorm" "kra/internal/conf" - datapayment "kra/internal/data/payment" - datasystem "kra/internal/data/system" - "kra/internal/integration/storage" + datapayment "kra/internal/modules/system/data/payment" + datasystem "kra/internal/modules/system/data/repository" + "kra/internal/modules/system/integration/storage" ) var ProviderSet = wire.NewSet( diff --git a/internal/data/data_scope.go b/internal/modules/system/data/data_scope.go similarity index 99% rename from internal/data/data_scope.go rename to internal/modules/system/data/data_scope.go index 8211723..a6ed497 100644 --- a/internal/data/data_scope.go +++ b/internal/modules/system/data/data_scope.go @@ -7,7 +7,7 @@ import ( "reflect" "strings" - "kra/internal/biz" + "kra/internal/modules/system/biz" "gorm.io/gorm" "gorm.io/gorm/clause" diff --git a/internal/data/data_scope_audit.go b/internal/modules/system/data/data_scope_audit.go similarity index 100% rename from internal/data/data_scope_audit.go rename to internal/modules/system/data/data_scope_audit.go diff --git a/internal/data/data_scope_audit_test.go b/internal/modules/system/data/data_scope_audit_test.go similarity index 100% rename from internal/data/data_scope_audit_test.go rename to internal/modules/system/data/data_scope_audit_test.go diff --git a/internal/data/data_scope_record.go b/internal/modules/system/data/data_scope_record.go similarity index 100% rename from internal/data/data_scope_record.go rename to internal/modules/system/data/data_scope_record.go diff --git a/internal/data/data_scope_test.go b/internal/modules/system/data/data_scope_test.go similarity index 98% rename from internal/data/data_scope_test.go rename to internal/modules/system/data/data_scope_test.go index 56175e7..27e077e 100644 --- a/internal/data/data_scope_test.go +++ b/internal/modules/system/data/data_scope_test.go @@ -5,7 +5,7 @@ import ( "errors" "testing" - "kra/internal/biz" + "kra/internal/modules/system/biz" "gorm.io/gorm" ) diff --git a/internal/data/database.go b/internal/modules/system/data/database.go similarity index 99% rename from internal/data/database.go rename to internal/modules/system/data/database.go index 73c4cd5..91cb638 100644 --- a/internal/data/database.go +++ b/internal/modules/system/data/database.go @@ -20,7 +20,7 @@ import ( "gorm.io/gorm/logger" "gorm.io/gorm/schema" "kra/internal/conf" - "kra/internal/data/gormkit" + "kra/internal/platform/database/gormkit" ) var databaseNamePattern = regexp.MustCompile(`^[A-Za-z][A-Za-z0-9_$-]*$`) diff --git a/internal/data/gorm_logger_test.go b/internal/modules/system/data/gorm_logger_test.go similarity index 96% rename from internal/data/gorm_logger_test.go rename to internal/modules/system/data/gorm_logger_test.go index c6241d3..7444afd 100644 --- a/internal/data/gorm_logger_test.go +++ b/internal/modules/system/data/gorm_logger_test.go @@ -8,8 +8,8 @@ import ( "testing" "time" - "kra/internal/data/gormkit" "kra/internal/logging" + "kra/internal/platform/database/gormkit" "gorm.io/gorm/logger" ) diff --git a/internal/data/initialization_backend.go b/internal/modules/system/data/initialization_backend.go similarity index 98% rename from internal/data/initialization_backend.go rename to internal/modules/system/data/initialization_backend.go index de5e6af..cadab84 100644 --- a/internal/data/initialization_backend.go +++ b/internal/modules/system/data/initialization_backend.go @@ -5,9 +5,9 @@ import ( "errors" "fmt" - "kra/internal/biz" "kra/internal/conf" - "kra/internal/integration/storage" + "kra/internal/modules/system/biz" + "kra/internal/modules/system/integration/storage" "github.com/google/uuid" "google.golang.org/protobuf/encoding/protojson" diff --git a/internal/data/initialization_backend_test.go b/internal/modules/system/data/initialization_backend_test.go similarity index 100% rename from internal/data/initialization_backend_test.go rename to internal/modules/system/data/initialization_backend_test.go diff --git a/internal/data/integration_config.go b/internal/modules/system/data/integration_config.go similarity index 100% rename from internal/data/integration_config.go rename to internal/modules/system/data/integration_config.go diff --git a/internal/data/integration_config_test.go b/internal/modules/system/data/integration_config_test.go similarity index 99% rename from internal/data/integration_config_test.go rename to internal/modules/system/data/integration_config_test.go index 8a8634d..e1eaf29 100644 --- a/internal/data/integration_config_test.go +++ b/internal/modules/system/data/integration_config_test.go @@ -8,7 +8,7 @@ import ( "testing" "kra/internal/conf" - "kra/internal/integration/storage" + "kra/internal/modules/system/integration/storage" "google.golang.org/protobuf/encoding/protojson" "gopkg.in/yaml.v3" diff --git a/internal/data/migrations.go b/internal/modules/system/data/migrations.go similarity index 68% rename from internal/data/migrations.go rename to internal/modules/system/data/migrations.go index d69eda0..41f1d01 100644 --- a/internal/data/migrations.go +++ b/internal/modules/system/data/migrations.go @@ -1,9 +1,9 @@ package data import ( - "kra/internal/data/migration" - datapayment "kra/internal/data/payment" - datasystem "kra/internal/data/system" + datapayment "kra/internal/modules/system/data/payment" + datasystem "kra/internal/modules/system/data/repository" + "kra/internal/platform/database/migration" "gorm.io/gorm" ) @@ -14,7 +14,7 @@ func migrateAll(db *gorm.DB) error { steps := []migration.Step{{ ID: "202608200001_data_infrastructure", Migrate: func(db *gorm.DB) error { - return db.AutoMigrate(&integrationConfigPO{}) + return migration.CreateMissingTables(db, &integrationConfigPO{}) }, }} steps = append(steps, datasystem.Migrations()...) diff --git a/internal/data/migrations_test.go b/internal/modules/system/data/migrations_test.go similarity index 95% rename from internal/data/migrations_test.go rename to internal/modules/system/data/migrations_test.go index 5ec3c97..c3ac4a4 100644 --- a/internal/data/migrations_test.go +++ b/internal/modules/system/data/migrations_test.go @@ -3,7 +3,7 @@ package data import ( "testing" - "kra/internal/data/migration" + "kra/internal/platform/database/migration" ) func TestMigrateAllRunsModuleSchemasWithoutBootstrapSeed(t *testing.T) { diff --git a/internal/data/mongo.go b/internal/modules/system/data/mongo.go similarity index 100% rename from internal/data/mongo.go rename to internal/modules/system/data/mongo.go diff --git a/internal/data/payment/migrations.go b/internal/modules/system/data/payment/migrations.go similarity index 90% rename from internal/data/payment/migrations.go rename to internal/modules/system/data/payment/migrations.go index a9f5145..dbf0b66 100644 --- a/internal/data/payment/migrations.go +++ b/internal/modules/system/data/payment/migrations.go @@ -1,8 +1,8 @@ package payment import ( - "kra/internal/adminsurface" - "kra/internal/data/migration" + "kra/internal/modules/system/adminsurface" + "kra/internal/platform/database/migration" "gorm.io/gorm" ) @@ -10,7 +10,7 @@ import ( func Migrations() []migration.Step { return []migration.Step{ {ID: "202608200003_payment_schema", Migrate: func(db *gorm.DB) error { - return db.AutoMigrate(&paymentOrderPO{}) + return migration.CreateMissingTables(db, &paymentOrderPO{}) }}, {ID: "202608200004_payment_defaults", Migrate: ensurePaymentIntegrationConfigs}, } diff --git a/internal/data/payment/models.go b/internal/modules/system/data/payment/models.go similarity index 100% rename from internal/data/payment/models.go rename to internal/modules/system/data/payment/models.go diff --git a/internal/data/payment/payment.go b/internal/modules/system/data/payment/payment.go similarity index 99% rename from internal/data/payment/payment.go rename to internal/modules/system/data/payment/payment.go index ac55cb8..493703d 100644 --- a/internal/data/payment/payment.go +++ b/internal/modules/system/data/payment/payment.go @@ -11,8 +11,8 @@ import ( "strconv" "strings" - "kra/internal/biz" - datapayment "kra/internal/integration/payment" + "kra/internal/modules/system/biz" + datapayment "kra/internal/modules/system/integration/payment" "gorm.io/gorm" ) diff --git a/internal/data/payment/payment_config_test.go b/internal/modules/system/data/payment/payment_config_test.go similarity index 99% rename from internal/data/payment/payment_config_test.go rename to internal/modules/system/data/payment/payment_config_test.go index e06d289..1c82540 100644 --- a/internal/data/payment/payment_config_test.go +++ b/internal/modules/system/data/payment/payment_config_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "kra/internal/biz" + "kra/internal/modules/system/biz" ) func TestSavePaymentConfigRequiresDouyinAppIDWhenEnabled(t *testing.T) { diff --git a/internal/data/payment/payment_helpers.go b/internal/modules/system/data/payment/payment_helpers.go similarity index 91% rename from internal/data/payment/payment_helpers.go rename to internal/modules/system/data/payment/payment_helpers.go index e490cca..b55d929 100644 --- a/internal/data/payment/payment_helpers.go +++ b/internal/modules/system/data/payment/payment_helpers.go @@ -1,6 +1,6 @@ package payment -import "kra/internal/utils/paymentutil" +import "kra/internal/modules/system/utils/paymentutil" func text(values map[string]any, key string) string { value, _ := values[key].(string) diff --git a/internal/data/payment/payment_native_test.go b/internal/modules/system/data/payment/payment_native_test.go similarity index 99% rename from internal/data/payment/payment_native_test.go rename to internal/modules/system/data/payment/payment_native_test.go index f4f0922..5ec1513 100644 --- a/internal/data/payment/payment_native_test.go +++ b/internal/modules/system/data/payment/payment_native_test.go @@ -5,7 +5,7 @@ import ( "encoding/json" "testing" - "kra/internal/biz" + "kra/internal/modules/system/biz" ) func TestMigrateSeedsPaymentProviders(t *testing.T) { diff --git a/internal/data/payment/payment_order.go b/internal/modules/system/data/payment/payment_order.go similarity index 99% rename from internal/data/payment/payment_order.go rename to internal/modules/system/data/payment/payment_order.go index 7813103..420e3be 100644 --- a/internal/data/payment/payment_order.go +++ b/internal/modules/system/data/payment/payment_order.go @@ -10,8 +10,8 @@ import ( "github.com/google/uuid" "gorm.io/gorm" "gorm.io/gorm/clause" - "kra/internal/biz" - "kra/internal/data/pagination" + "kra/internal/modules/system/biz" + "kra/internal/platform/database/pagination" ) type paymentOrderPO struct { diff --git a/internal/data/payment/payment_order_test.go b/internal/modules/system/data/payment/payment_order_test.go similarity index 99% rename from internal/data/payment/payment_order_test.go rename to internal/modules/system/data/payment/payment_order_test.go index af5ced5..23ab522 100644 --- a/internal/data/payment/payment_order_test.go +++ b/internal/modules/system/data/payment/payment_order_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "kra/internal/biz" + "kra/internal/modules/system/biz" ) func newPaymentOrderRepoForTest(t *testing.T) *paymentOrderRepo { diff --git a/internal/data/payment/provider.go b/internal/modules/system/data/payment/provider.go similarity index 100% rename from internal/data/payment/provider.go rename to internal/modules/system/data/payment/provider.go diff --git a/internal/data/payment/testing_support_test.go b/internal/modules/system/data/payment/testing_support_test.go similarity index 100% rename from internal/data/payment/testing_support_test.go rename to internal/modules/system/data/payment/testing_support_test.go diff --git a/internal/data/system/announcement.go b/internal/modules/system/data/repository/announcement.go similarity index 96% rename from internal/data/system/announcement.go rename to internal/modules/system/data/repository/announcement.go index 8bcf1e1..05ac9dc 100644 --- a/internal/data/system/announcement.go +++ b/internal/modules/system/data/repository/announcement.go @@ -5,9 +5,9 @@ import ( "encoding/json" "time" - "kra/internal/biz" - "kra/internal/data/gormkit" - "kra/internal/data/pagination" + "kra/internal/modules/system/biz" + "kra/internal/platform/database/gormkit" + "kra/internal/platform/database/pagination" "gorm.io/gorm" ) diff --git a/internal/data/system/announcement_test.go b/internal/modules/system/data/repository/announcement_test.go similarity index 97% rename from internal/data/system/announcement_test.go rename to internal/modules/system/data/repository/announcement_test.go index 1623352..e137db5 100644 --- a/internal/data/system/announcement_test.go +++ b/internal/modules/system/data/repository/announcement_test.go @@ -4,7 +4,7 @@ import ( "context" "testing" - "kra/internal/biz" + "kra/internal/modules/system/biz" ) func TestAnnouncementRepositoryKeepsRawIDQuerySemantics(t *testing.T) { diff --git a/internal/data/system/api.go b/internal/modules/system/data/repository/api.go similarity index 98% rename from internal/data/system/api.go rename to internal/modules/system/data/repository/api.go index 64bb437..be92789 100644 --- a/internal/data/system/api.go +++ b/internal/modules/system/data/repository/api.go @@ -6,8 +6,8 @@ import ( "strconv" "time" - "kra/internal/biz" - "kra/internal/data/pagination" + "kra/internal/modules/system/biz" + "kra/internal/platform/database/pagination" "gorm.io/gorm" ) diff --git a/internal/data/system/api_policy.go b/internal/modules/system/data/repository/api_policy.go similarity index 99% rename from internal/data/system/api_policy.go rename to internal/modules/system/data/repository/api_policy.go index 95a4eb8..e4f0617 100644 --- a/internal/data/system/api_policy.go +++ b/internal/modules/system/data/repository/api_policy.go @@ -5,7 +5,7 @@ import ( "errors" "strconv" - "kra/internal/biz" + "kra/internal/modules/system/biz" "github.com/casbin/casbin/v3" casbinmodel "github.com/casbin/casbin/v3/model" diff --git a/internal/data/system/api_policy_test.go b/internal/modules/system/data/repository/api_policy_test.go similarity index 99% rename from internal/data/system/api_policy_test.go rename to internal/modules/system/data/repository/api_policy_test.go index 2d87813..90ea4db 100644 --- a/internal/data/system/api_policy_test.go +++ b/internal/modules/system/data/repository/api_policy_test.go @@ -5,8 +5,8 @@ import ( "strings" "testing" - "kra/internal/biz" "kra/internal/conf" + "kra/internal/modules/system/biz" ) func newPolicyTestData(t *testing.T) *Data { diff --git a/internal/data/system/api_sync.go b/internal/modules/system/data/repository/api_sync.go similarity index 98% rename from internal/data/system/api_sync.go rename to internal/modules/system/data/repository/api_sync.go index e3aa634..d17ea9c 100644 --- a/internal/data/system/api_sync.go +++ b/internal/modules/system/data/repository/api_sync.go @@ -3,7 +3,7 @@ package system import ( "context" - "kra/internal/biz" + "kra/internal/modules/system/biz" "gorm.io/gorm" ) diff --git a/internal/data/system/api_token.go b/internal/modules/system/data/repository/api_token.go similarity index 98% rename from internal/data/system/api_token.go rename to internal/modules/system/data/repository/api_token.go index 369662f..522e1ca 100644 --- a/internal/data/system/api_token.go +++ b/internal/modules/system/data/repository/api_token.go @@ -5,8 +5,8 @@ import ( "errors" "time" - "kra/internal/biz" - "kra/internal/data/pagination" + "kra/internal/modules/system/biz" + "kra/internal/platform/database/pagination" "gorm.io/gorm" ) diff --git a/internal/data/system/audit.go b/internal/modules/system/data/repository/audit.go similarity index 91% rename from internal/data/system/audit.go rename to internal/modules/system/data/repository/audit.go index e10dc88..7c6d3cf 100644 --- a/internal/data/system/audit.go +++ b/internal/modules/system/data/repository/audit.go @@ -1,6 +1,6 @@ package system -import "kra/internal/biz" +import "kra/internal/modules/system/biz" type auditQueryRepo struct{ data Provider } type auditRecorderRepo struct{ data Provider } diff --git a/internal/data/system/audit_delete_test.go b/internal/modules/system/data/repository/audit_delete_test.go similarity index 100% rename from internal/data/system/audit_delete_test.go rename to internal/modules/system/data/repository/audit_delete_test.go diff --git a/internal/data/system/authority.go b/internal/modules/system/data/repository/authority.go similarity index 99% rename from internal/data/system/authority.go rename to internal/modules/system/data/repository/authority.go index 2eae127..5625da4 100644 --- a/internal/data/system/authority.go +++ b/internal/modules/system/data/repository/authority.go @@ -4,7 +4,7 @@ import ( "context" "errors" - "kra/internal/biz" + "kra/internal/modules/system/biz" "gorm.io/gorm" ) diff --git a/internal/data/system/authority_test.go b/internal/modules/system/data/repository/authority_test.go similarity index 99% rename from internal/data/system/authority_test.go rename to internal/modules/system/data/repository/authority_test.go index cec035d..73c7761 100644 --- a/internal/data/system/authority_test.go +++ b/internal/modules/system/data/repository/authority_test.go @@ -5,8 +5,8 @@ import ( "errors" "testing" - "kra/internal/biz" "kra/internal/conf" + "kra/internal/modules/system/biz" "gorm.io/gorm" ) diff --git a/internal/data/system/bootstrap.go b/internal/modules/system/data/repository/bootstrap.go similarity index 100% rename from internal/data/system/bootstrap.go rename to internal/modules/system/data/repository/bootstrap.go diff --git a/internal/data/system/casbin.go b/internal/modules/system/data/repository/casbin.go similarity index 100% rename from internal/data/system/casbin.go rename to internal/modules/system/data/repository/casbin.go diff --git a/internal/data/system/data_access_log.go b/internal/modules/system/data/repository/data_access_log.go similarity index 96% rename from internal/data/system/data_access_log.go rename to internal/modules/system/data/repository/data_access_log.go index d4681c9..b52c6a1 100644 --- a/internal/data/system/data_access_log.go +++ b/internal/modules/system/data/repository/data_access_log.go @@ -4,8 +4,8 @@ import ( "context" "time" - "kra/internal/biz" - "kra/internal/data/pagination" + "kra/internal/modules/system/biz" + "kra/internal/platform/database/pagination" "gorm.io/gorm" ) diff --git a/internal/data/system/department.go b/internal/modules/system/data/repository/department.go similarity index 99% rename from internal/data/system/department.go rename to internal/modules/system/data/repository/department.go index 0a4cf19..dd41eeb 100644 --- a/internal/data/system/department.go +++ b/internal/modules/system/data/repository/department.go @@ -7,7 +7,7 @@ import ( "strings" "time" - "kra/internal/biz" + "kra/internal/modules/system/biz" "gorm.io/gorm" ) diff --git a/internal/data/system/dictionary.go b/internal/modules/system/data/repository/dictionary.go similarity index 99% rename from internal/data/system/dictionary.go rename to internal/modules/system/data/repository/dictionary.go index e5420e9..8959170 100644 --- a/internal/data/system/dictionary.go +++ b/internal/modules/system/data/repository/dictionary.go @@ -7,8 +7,8 @@ import ( "strings" "time" - "kra/internal/biz" - "kra/internal/data/pagination" + "kra/internal/modules/system/biz" + "kra/internal/platform/database/pagination" "gorm.io/gorm" ) diff --git a/internal/data/system/dictionary_department_parity_test.go b/internal/modules/system/data/repository/dictionary_department_parity_test.go similarity index 99% rename from internal/data/system/dictionary_department_parity_test.go rename to internal/modules/system/data/repository/dictionary_department_parity_test.go index 10954a4..777a8cc 100644 --- a/internal/data/system/dictionary_department_parity_test.go +++ b/internal/modules/system/data/repository/dictionary_department_parity_test.go @@ -4,7 +4,7 @@ import ( "context" "testing" - "kra/internal/biz" + "kra/internal/modules/system/biz" ) func TestDictionaryListPreservesPreloadCollectionShapes(t *testing.T) { diff --git a/internal/data/system/error_record.go b/internal/modules/system/data/repository/error_record.go similarity index 97% rename from internal/data/system/error_record.go rename to internal/modules/system/data/repository/error_record.go index 049b4c1..33b95f4 100644 --- a/internal/data/system/error_record.go +++ b/internal/modules/system/data/repository/error_record.go @@ -4,8 +4,8 @@ import ( "context" "time" - "kra/internal/biz" - "kra/internal/data/pagination" + "kra/internal/modules/system/biz" + "kra/internal/platform/database/pagination" "gorm.io/gorm" ) diff --git a/internal/data/system/error_record_test.go b/internal/modules/system/data/repository/error_record_test.go similarity index 99% rename from internal/data/system/error_record_test.go rename to internal/modules/system/data/repository/error_record_test.go index d3c5e81..9237f9f 100644 --- a/internal/data/system/error_record_test.go +++ b/internal/modules/system/data/repository/error_record_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "kra/internal/biz" + "kra/internal/modules/system/biz" ) func errorString(value string) *string { return &value } diff --git a/internal/data/system/export.go b/internal/modules/system/data/repository/export.go similarity index 99% rename from internal/data/system/export.go rename to internal/modules/system/data/repository/export.go index c7c2065..d30c595 100644 --- a/internal/data/system/export.go +++ b/internal/modules/system/data/repository/export.go @@ -7,7 +7,7 @@ import ( "fmt" "gorm.io/gorm" "gorm.io/gorm/clause" - "kra/internal/biz" + "kra/internal/modules/system/biz" "strconv" "strings" "time" diff --git a/internal/data/system/log_file.go b/internal/modules/system/data/repository/log_file.go similarity index 99% rename from internal/data/system/log_file.go rename to internal/modules/system/data/repository/log_file.go index 3127fc8..540bf45 100644 --- a/internal/data/system/log_file.go +++ b/internal/modules/system/data/repository/log_file.go @@ -14,7 +14,7 @@ import ( "strings" "time" - "kra/internal/biz" + "kra/internal/modules/system/biz" ) const ( diff --git a/internal/data/system/log_file_test.go b/internal/modules/system/data/repository/log_file_test.go similarity index 97% rename from internal/data/system/log_file_test.go rename to internal/modules/system/data/repository/log_file_test.go index f8588b6..46f5565 100644 --- a/internal/data/system/log_file_test.go +++ b/internal/modules/system/data/repository/log_file_test.go @@ -7,8 +7,8 @@ import ( "path/filepath" "testing" - "kra/internal/biz" "kra/internal/conf" + "kra/internal/modules/system/biz" ) func TestLogViewerReadsNestedCategoryFiles(t *testing.T) { diff --git a/internal/data/system/login_log.go b/internal/modules/system/data/repository/login_log.go similarity index 96% rename from internal/data/system/login_log.go rename to internal/modules/system/data/repository/login_log.go index 1b5199f..a4ca46b 100644 --- a/internal/data/system/login_log.go +++ b/internal/modules/system/data/repository/login_log.go @@ -4,8 +4,8 @@ import ( "context" "time" - "kra/internal/biz" - "kra/internal/data/pagination" + "kra/internal/modules/system/biz" + "kra/internal/platform/database/pagination" "gorm.io/gorm" ) diff --git a/internal/data/system/media.go b/internal/modules/system/data/repository/media.go similarity index 99% rename from internal/data/system/media.go rename to internal/modules/system/data/repository/media.go index 67c53d4..1144c95 100644 --- a/internal/data/system/media.go +++ b/internal/modules/system/data/repository/media.go @@ -5,7 +5,7 @@ import ( "errors" "time" - "kra/internal/biz" + "kra/internal/modules/system/biz" "gorm.io/gorm" ) diff --git a/internal/data/system/media_test.go b/internal/modules/system/data/repository/media_test.go similarity index 95% rename from internal/data/system/media_test.go rename to internal/modules/system/data/repository/media_test.go index cd91a3e..6f8a349 100644 --- a/internal/data/system/media_test.go +++ b/internal/modules/system/data/repository/media_test.go @@ -4,7 +4,7 @@ import ( "context" "testing" - "kra/internal/biz" + "kra/internal/modules/system/biz" ) func TestMediaListKeepsZeroPageSizeContract(t *testing.T) { diff --git a/internal/data/system/media_upload.go b/internal/modules/system/data/repository/media_upload.go similarity index 99% rename from internal/data/system/media_upload.go rename to internal/modules/system/data/repository/media_upload.go index ca30eba..822a7f3 100644 --- a/internal/data/system/media_upload.go +++ b/internal/modules/system/data/repository/media_upload.go @@ -5,7 +5,7 @@ import ( "errors" "time" - "kra/internal/biz" + "kra/internal/modules/system/biz" "gorm.io/gorm" "gorm.io/gorm/clause" diff --git a/internal/data/system/menu.go b/internal/modules/system/data/repository/menu.go similarity index 99% rename from internal/data/system/menu.go rename to internal/modules/system/data/repository/menu.go index 681a8d0..8b11c2f 100644 --- a/internal/data/system/menu.go +++ b/internal/modules/system/data/repository/menu.go @@ -5,7 +5,7 @@ import ( "errors" "time" - "kra/internal/biz" + "kra/internal/modules/system/biz" "gorm.io/gorm" ) diff --git a/internal/data/system/menu_test.go b/internal/modules/system/data/repository/menu_test.go similarity index 99% rename from internal/data/system/menu_test.go rename to internal/modules/system/data/repository/menu_test.go index b02e3a6..a4036e5 100644 --- a/internal/data/system/menu_test.go +++ b/internal/modules/system/data/repository/menu_test.go @@ -5,8 +5,8 @@ import ( "testing" "time" - "kra/internal/biz" "kra/internal/conf" + "kra/internal/modules/system/biz" ) func newMenuTestData(t *testing.T) *Data { diff --git a/internal/data/system/migrations.go b/internal/modules/system/data/repository/migrations.go similarity index 92% rename from internal/data/system/migrations.go rename to internal/modules/system/data/repository/migrations.go index a716ee4..c98ae77 100644 --- a/internal/data/system/migrations.go +++ b/internal/modules/system/data/repository/migrations.go @@ -1,7 +1,7 @@ package system import ( - "kra/internal/data/migration" + "kra/internal/platform/database/migration" "gorm.io/gorm" ) @@ -14,7 +14,7 @@ func Migrations() []migration.Step { { ID: "202608200002_system_schema", Migrate: func(db *gorm.DB) error { - return db.AutoMigrate( + return migration.CreateMissingTables(db, &userPO{}, &authorityPO{}, &menuPO{}, &userAuthorityPO{}, &authorityMenuPO{}, &menuParameterPO{}, &apiPO{}, &ignoredAPIPO{}, &authorityAPIPO{}, &casbinRulePO{}, &menuButtonPO{}, &authorityButtonPO{}, &departmentPO{}, &positionPO{}, &userDepartmentPO{}, &userPositionPO{}, &authorityDepartmentPO{}, diff --git a/internal/data/system/migrations_test.go b/internal/modules/system/data/repository/migrations_test.go similarity index 100% rename from internal/data/system/migrations_test.go rename to internal/modules/system/data/repository/migrations_test.go diff --git a/internal/data/system/models.go b/internal/modules/system/data/repository/models.go similarity index 98% rename from internal/data/system/models.go rename to internal/modules/system/data/repository/models.go index 4ebe473..f9dbb30 100644 --- a/internal/data/system/models.go +++ b/internal/modules/system/data/repository/models.go @@ -3,7 +3,7 @@ package system import ( "time" - "kra/internal/biz" + "kra/internal/modules/system/biz" "gorm.io/gorm" ) diff --git a/internal/data/system/operation_log.go b/internal/modules/system/data/repository/operation_log.go similarity index 97% rename from internal/data/system/operation_log.go rename to internal/modules/system/data/repository/operation_log.go index 2cb7fdf..8cdabe1 100644 --- a/internal/data/system/operation_log.go +++ b/internal/modules/system/data/repository/operation_log.go @@ -4,8 +4,8 @@ import ( "context" "time" - "kra/internal/biz" - "kra/internal/data/pagination" + "kra/internal/modules/system/biz" + "kra/internal/platform/database/pagination" "gorm.io/gorm" ) diff --git a/internal/data/system/organization_test.go b/internal/modules/system/data/repository/organization_test.go similarity index 100% rename from internal/data/system/organization_test.go rename to internal/modules/system/data/repository/organization_test.go diff --git a/internal/data/system/parameter.go b/internal/modules/system/data/repository/parameter.go similarity index 97% rename from internal/data/system/parameter.go rename to internal/modules/system/data/repository/parameter.go index 742598a..00c92d2 100644 --- a/internal/data/system/parameter.go +++ b/internal/modules/system/data/repository/parameter.go @@ -4,8 +4,8 @@ import ( "context" "time" - "kra/internal/biz" - "kra/internal/data/pagination" + "kra/internal/modules/system/biz" + "kra/internal/platform/database/pagination" "gorm.io/gorm" "gorm.io/gorm/clause" diff --git a/internal/data/system/parameter_test.go b/internal/modules/system/data/repository/parameter_test.go similarity index 98% rename from internal/data/system/parameter_test.go rename to internal/modules/system/data/repository/parameter_test.go index d0430bb..3a259dc 100644 --- a/internal/data/system/parameter_test.go +++ b/internal/modules/system/data/repository/parameter_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "kra/internal/biz" + "kra/internal/modules/system/biz" ) func TestParameterRepositoryPreservesModelMetadata(t *testing.T) { diff --git a/internal/data/system/permission.go b/internal/modules/system/data/repository/permission.go similarity index 99% rename from internal/data/system/permission.go rename to internal/modules/system/data/repository/permission.go index b98d67a..297e98c 100644 --- a/internal/data/system/permission.go +++ b/internal/modules/system/data/repository/permission.go @@ -5,7 +5,7 @@ import ( "errors" "time" - "kra/internal/biz" + "kra/internal/modules/system/biz" "gorm.io/gorm" ) diff --git a/internal/data/system/permission_test.go b/internal/modules/system/data/repository/permission_test.go similarity index 99% rename from internal/data/system/permission_test.go rename to internal/modules/system/data/repository/permission_test.go index e5cbc0a..06c397d 100644 --- a/internal/data/system/permission_test.go +++ b/internal/modules/system/data/repository/permission_test.go @@ -4,8 +4,8 @@ import ( "context" "testing" - "kra/internal/biz" "kra/internal/conf" + "kra/internal/modules/system/biz" ) func TestPermissionSelectedButtonsEmptyShape(t *testing.T) { diff --git a/internal/data/system/position.go b/internal/modules/system/data/repository/position.go similarity index 99% rename from internal/data/system/position.go rename to internal/modules/system/data/repository/position.go index 321f953..8a4d0de 100644 --- a/internal/data/system/position.go +++ b/internal/modules/system/data/repository/position.go @@ -5,7 +5,7 @@ import ( "errors" "time" - "kra/internal/biz" + "kra/internal/modules/system/biz" "gorm.io/gorm" ) diff --git a/internal/data/system/provider.go b/internal/modules/system/data/repository/provider.go similarity index 100% rename from internal/data/system/provider.go rename to internal/modules/system/data/repository/provider.go diff --git a/internal/data/system/runtime.go b/internal/modules/system/data/repository/runtime.go similarity index 98% rename from internal/data/system/runtime.go rename to internal/modules/system/data/repository/runtime.go index f97613c..f709d49 100644 --- a/internal/data/system/runtime.go +++ b/internal/modules/system/data/repository/runtime.go @@ -6,9 +6,9 @@ import ( "errors" "time" - "kra/internal/biz" "kra/internal/conf" - "kra/internal/security/adminauth" + "kra/internal/modules/system/biz" + "kra/internal/modules/system/security/adminauth" jwt "github.com/golang-jwt/jwt/v5" ) diff --git a/internal/data/system/security.go b/internal/modules/system/data/repository/security.go similarity index 99% rename from internal/data/system/security.go rename to internal/modules/system/data/repository/security.go index a689b4a..49390d2 100644 --- a/internal/data/system/security.go +++ b/internal/modules/system/data/repository/security.go @@ -5,7 +5,7 @@ import ( "errors" "time" - "kra/internal/biz" + "kra/internal/modules/system/biz" "gorm.io/gorm" ) diff --git a/internal/data/system/seed.go b/internal/modules/system/data/repository/seed.go similarity index 99% rename from internal/data/system/seed.go rename to internal/modules/system/data/repository/seed.go index 8e4c83b..69a12c8 100644 --- a/internal/data/system/seed.go +++ b/internal/modules/system/data/repository/seed.go @@ -5,8 +5,8 @@ import ( "strings" "time" - "kra/internal/adminsurface" - "kra/internal/biz" + "kra/internal/modules/system/adminsurface" + "kra/internal/modules/system/biz" "github.com/google/uuid" "golang.org/x/crypto/bcrypt" diff --git a/internal/data/system/seed_test.go b/internal/modules/system/data/repository/seed_test.go similarity index 95% rename from internal/data/system/seed_test.go rename to internal/modules/system/data/repository/seed_test.go index 1d88421..2c8bacf 100644 --- a/internal/data/system/seed_test.go +++ b/internal/modules/system/data/repository/seed_test.go @@ -4,8 +4,8 @@ import ( "context" "testing" - "kra/internal/adminsurface" - "kra/internal/biz" + "kra/internal/modules/system/adminsurface" + "kra/internal/modules/system/biz" ) func TestSeedSystemCreatesInitialDataAndModuleSurface(t *testing.T) { diff --git a/internal/data/system/system_init_ignore_test.go b/internal/modules/system/data/repository/system_init_ignore_test.go similarity index 100% rename from internal/data/system/system_init_ignore_test.go rename to internal/modules/system/data/repository/system_init_ignore_test.go diff --git a/internal/data/system/task.go b/internal/modules/system/data/repository/task.go similarity index 98% rename from internal/data/system/task.go rename to internal/modules/system/data/repository/task.go index 62f846f..1a5a248 100644 --- a/internal/data/system/task.go +++ b/internal/modules/system/data/repository/task.go @@ -2,9 +2,9 @@ package system import ( "context" - "kra/internal/biz" - "kra/internal/data/gormkit" - "kra/internal/data/pagination" + "kra/internal/modules/system/biz" + "kra/internal/platform/database/gormkit" + "kra/internal/platform/database/pagination" "time" "gorm.io/gorm" diff --git a/internal/data/system/testing_support_test.go b/internal/modules/system/data/repository/testing_support_test.go similarity index 100% rename from internal/data/system/testing_support_test.go rename to internal/modules/system/data/repository/testing_support_test.go diff --git a/internal/data/system/transactions_test.go b/internal/modules/system/data/repository/transactions_test.go similarity index 99% rename from internal/data/system/transactions_test.go rename to internal/modules/system/data/repository/transactions_test.go index c3b00c4..12e95c3 100644 --- a/internal/data/system/transactions_test.go +++ b/internal/modules/system/data/repository/transactions_test.go @@ -5,8 +5,8 @@ import ( "strings" "testing" - "kra/internal/biz" "kra/internal/conf" + "kra/internal/modules/system/biz" ) func newTransactionTestData(t *testing.T) *Data { diff --git a/internal/data/system/user.go b/internal/modules/system/data/repository/user.go similarity index 99% rename from internal/data/system/user.go rename to internal/modules/system/data/repository/user.go index ca2d5b4..3292a9b 100644 --- a/internal/data/system/user.go +++ b/internal/modules/system/data/repository/user.go @@ -8,8 +8,8 @@ import ( "strings" "time" - "kra/internal/biz" - "kra/internal/data/pagination" + "kra/internal/modules/system/biz" + "kra/internal/platform/database/pagination" "github.com/google/uuid" "gorm.io/gorm" diff --git a/internal/data/system/user_strict_test.go b/internal/modules/system/data/repository/user_strict_test.go similarity index 99% rename from internal/data/system/user_strict_test.go rename to internal/modules/system/data/repository/user_strict_test.go index 9933607..63f54d4 100644 --- a/internal/data/system/user_strict_test.go +++ b/internal/modules/system/data/repository/user_strict_test.go @@ -4,7 +4,7 @@ import ( "context" "testing" - "kra/internal/biz" + "kra/internal/modules/system/biz" ) func seedStrictUserTree(t *testing.T, data *Data) (actorID, childID, siblingID uint, users []userPO) { diff --git a/internal/data/system/version.go b/internal/modules/system/data/repository/version.go similarity index 99% rename from internal/data/system/version.go rename to internal/modules/system/data/repository/version.go index 8cc46ad..ab00ca3 100644 --- a/internal/data/system/version.go +++ b/internal/modules/system/data/repository/version.go @@ -6,8 +6,8 @@ import ( "time" "gorm.io/gorm" - "kra/internal/biz" - "kra/internal/data/pagination" + "kra/internal/modules/system/biz" + "kra/internal/platform/database/pagination" ) type versionPO struct { diff --git a/internal/data/system/version_test.go b/internal/modules/system/data/repository/version_test.go similarity index 100% rename from internal/data/system/version_test.go rename to internal/modules/system/data/repository/version_test.go diff --git a/internal/data/runtime_clients.go b/internal/modules/system/data/runtime_clients.go similarity index 100% rename from internal/data/runtime_clients.go rename to internal/modules/system/data/runtime_clients.go diff --git a/internal/service/dto/announcement.go b/internal/modules/system/dto/announcement.go similarity index 100% rename from internal/service/dto/announcement.go rename to internal/modules/system/dto/announcement.go diff --git a/internal/service/dto/api.go b/internal/modules/system/dto/api.go similarity index 100% rename from internal/service/dto/api.go rename to internal/modules/system/dto/api.go diff --git a/internal/service/dto/audit.go b/internal/modules/system/dto/audit.go similarity index 100% rename from internal/service/dto/audit.go rename to internal/modules/system/dto/audit.go diff --git a/internal/service/dto/audit_test.go b/internal/modules/system/dto/audit_test.go similarity index 100% rename from internal/service/dto/audit_test.go rename to internal/modules/system/dto/audit_test.go diff --git a/internal/service/dto/authentication.go b/internal/modules/system/dto/authentication.go similarity index 100% rename from internal/service/dto/authentication.go rename to internal/modules/system/dto/authentication.go diff --git a/internal/service/dto/authority.go b/internal/modules/system/dto/authority.go similarity index 100% rename from internal/service/dto/authority.go rename to internal/modules/system/dto/authority.go diff --git a/internal/service/dto/email.go b/internal/modules/system/dto/email.go similarity index 100% rename from internal/service/dto/email.go rename to internal/modules/system/dto/email.go diff --git a/internal/service/dto/export.go b/internal/modules/system/dto/export.go similarity index 100% rename from internal/service/dto/export.go rename to internal/modules/system/dto/export.go diff --git a/internal/service/dto/media.go b/internal/modules/system/dto/media.go similarity index 100% rename from internal/service/dto/media.go rename to internal/modules/system/dto/media.go diff --git a/internal/service/dto/menu.go b/internal/modules/system/dto/menu.go similarity index 100% rename from internal/service/dto/menu.go rename to internal/modules/system/dto/menu.go diff --git a/internal/service/dto/organization.go b/internal/modules/system/dto/organization.go similarity index 100% rename from internal/service/dto/organization.go rename to internal/modules/system/dto/organization.go diff --git a/internal/service/dto/payment.go b/internal/modules/system/dto/payment.go similarity index 100% rename from internal/service/dto/payment.go rename to internal/modules/system/dto/payment.go diff --git a/internal/service/dto/permission.go b/internal/modules/system/dto/permission.go similarity index 100% rename from internal/service/dto/permission.go rename to internal/modules/system/dto/permission.go diff --git a/internal/service/dto/settings.go b/internal/modules/system/dto/settings.go similarity index 100% rename from internal/service/dto/settings.go rename to internal/modules/system/dto/settings.go diff --git a/internal/service/dto/system.go b/internal/modules/system/dto/system.go similarity index 100% rename from internal/service/dto/system.go rename to internal/modules/system/dto/system.go diff --git a/internal/service/dto/system_config.go b/internal/modules/system/dto/system_config.go similarity index 100% rename from internal/service/dto/system_config.go rename to internal/modules/system/dto/system_config.go diff --git a/internal/service/dto/system_init.go b/internal/modules/system/dto/system_init.go similarity index 100% rename from internal/service/dto/system_init.go rename to internal/modules/system/dto/system_init.go diff --git a/internal/service/dto/task.go b/internal/modules/system/dto/task.go similarity index 100% rename from internal/service/dto/task.go rename to internal/modules/system/dto/task.go diff --git a/internal/service/dto/version.go b/internal/modules/system/dto/version.go similarity index 100% rename from internal/service/dto/version.go rename to internal/modules/system/dto/version.go diff --git a/internal/initialize/backend.go b/internal/modules/system/initialize/backend.go similarity index 95% rename from internal/initialize/backend.go rename to internal/modules/system/initialize/backend.go index 821cbf1..345eaf5 100644 --- a/internal/initialize/backend.go +++ b/internal/modules/system/initialize/backend.go @@ -3,8 +3,8 @@ package initialize import ( "context" - "kra/internal/biz" "kra/internal/conf" + "kra/internal/modules/system/biz" "gorm.io/gorm" ) diff --git a/internal/initialize/compatibility.go b/internal/modules/system/initialize/compatibility.go similarity index 100% rename from internal/initialize/compatibility.go rename to internal/modules/system/initialize/compatibility.go diff --git a/internal/initialize/configuration.go b/internal/modules/system/initialize/configuration.go similarity index 99% rename from internal/initialize/configuration.go rename to internal/modules/system/initialize/configuration.go index 42cef3e..b38032d 100644 --- a/internal/initialize/configuration.go +++ b/internal/modules/system/initialize/configuration.go @@ -5,7 +5,7 @@ import ( "encoding/json" "kra/internal/conf" - "kra/internal/utils/configutil" + "kra/internal/modules/system/utils/configutil" "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/proto" diff --git a/internal/initialize/initialize.go b/internal/modules/system/initialize/initialize.go similarity index 87% rename from internal/initialize/initialize.go rename to internal/modules/system/initialize/initialize.go index b4d7ca2..e50718b 100644 --- a/internal/initialize/initialize.go +++ b/internal/modules/system/initialize/initialize.go @@ -3,9 +3,9 @@ package initialize import ( "context" - "kra/internal/biz" - datapayment "kra/internal/data/payment" - datasystem "kra/internal/data/system" + "kra/internal/modules/system/biz" + datapayment "kra/internal/modules/system/data/payment" + datasystem "kra/internal/modules/system/data/repository" "gorm.io/gorm" ) diff --git a/internal/initialize/provider.go b/internal/modules/system/initialize/provider.go similarity index 100% rename from internal/initialize/provider.go rename to internal/modules/system/initialize/provider.go diff --git a/internal/integration/README.md b/internal/modules/system/integration/README.md similarity index 100% rename from internal/integration/README.md rename to internal/modules/system/integration/README.md diff --git a/internal/integration/cache/cache.go b/internal/modules/system/integration/cache/cache.go similarity index 98% rename from internal/integration/cache/cache.go rename to internal/modules/system/integration/cache/cache.go index 1393bab..cdc2cc5 100644 --- a/internal/integration/cache/cache.go +++ b/internal/modules/system/integration/cache/cache.go @@ -7,7 +7,7 @@ import ( "time" "github.com/redis/go-redis/v9" - "kra/internal/biz" + "kra/internal/modules/system/biz" ) type RedisProvider interface { diff --git a/internal/integration/email/email.go b/internal/modules/system/integration/email/email.go similarity index 99% rename from internal/integration/email/email.go rename to internal/modules/system/integration/email/email.go index 6332085..2f40fe0 100644 --- a/internal/integration/email/email.go +++ b/internal/modules/system/integration/email/email.go @@ -12,8 +12,8 @@ import ( "strings" "time" - "kra/internal/biz" "kra/internal/conf" + "kra/internal/modules/system/biz" ) type emailRepo struct { diff --git a/internal/integration/payment/adapter.go b/internal/modules/system/integration/payment/adapter.go similarity index 98% rename from internal/integration/payment/adapter.go rename to internal/modules/system/integration/payment/adapter.go index 6526702..6a3c03d 100644 --- a/internal/integration/payment/adapter.go +++ b/internal/modules/system/integration/payment/adapter.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "kra/internal/biz" + "kra/internal/modules/system/biz" ) // Adapter is the provider boundary used by the payment repository. Provider diff --git a/internal/integration/payment/adapter_test.go b/internal/modules/system/integration/payment/adapter_test.go similarity index 91% rename from internal/integration/payment/adapter_test.go rename to internal/modules/system/integration/payment/adapter_test.go index 29d6129..8b3c5c7 100644 --- a/internal/integration/payment/adapter_test.go +++ b/internal/modules/system/integration/payment/adapter_test.go @@ -3,7 +3,7 @@ package payment import ( "testing" - "kra/internal/biz" + "kra/internal/modules/system/biz" ) func TestEverySupportedProviderHasAdapter(t *testing.T) { diff --git a/internal/integration/payment/alipay.go b/internal/modules/system/integration/payment/alipay.go similarity index 99% rename from internal/integration/payment/alipay.go rename to internal/modules/system/integration/payment/alipay.go index 8ad00f2..d7abcf5 100644 --- a/internal/integration/payment/alipay.go +++ b/internal/modules/system/integration/payment/alipay.go @@ -13,7 +13,7 @@ import ( "strings" "time" - "kra/internal/biz" + "kra/internal/modules/system/biz" "github.com/go-pay/gopay" gopayAlipay "github.com/go-pay/gopay/alipay" diff --git a/internal/integration/payment/alipay_v3.go b/internal/modules/system/integration/payment/alipay_v3.go similarity index 99% rename from internal/integration/payment/alipay_v3.go rename to internal/modules/system/integration/payment/alipay_v3.go index af71081..f2220ee 100644 --- a/internal/integration/payment/alipay_v3.go +++ b/internal/modules/system/integration/payment/alipay_v3.go @@ -11,7 +11,7 @@ import ( "strings" "time" - "kra/internal/biz" + "kra/internal/modules/system/biz" "github.com/go-pay/gopay" gopayAlipay "github.com/go-pay/gopay/alipay" diff --git a/internal/integration/payment/alipay_v3_test.go b/internal/modules/system/integration/payment/alipay_v3_test.go similarity index 99% rename from internal/integration/payment/alipay_v3_test.go rename to internal/modules/system/integration/payment/alipay_v3_test.go index 37edf0d..4ab24f7 100644 --- a/internal/integration/payment/alipay_v3_test.go +++ b/internal/modules/system/integration/payment/alipay_v3_test.go @@ -17,7 +17,7 @@ import ( "testing" "time" - "kra/internal/biz" + "kra/internal/modules/system/biz" gopayAlipay "github.com/go-pay/gopay/alipay" gopayAlipayV3 "github.com/go-pay/gopay/alipay/v3" diff --git a/internal/integration/payment/allinpay.go b/internal/modules/system/integration/payment/allinpay.go similarity index 99% rename from internal/integration/payment/allinpay.go rename to internal/modules/system/integration/payment/allinpay.go index 37ffe10..6ced397 100644 --- a/internal/integration/payment/allinpay.go +++ b/internal/modules/system/integration/payment/allinpay.go @@ -15,7 +15,7 @@ import ( "strings" "sync" - "kra/internal/biz" + "kra/internal/modules/system/biz" "github.com/go-pay/crypto/xpem" "github.com/go-pay/crypto/xrsa" diff --git a/internal/integration/payment/allinpay_test.go b/internal/modules/system/integration/payment/allinpay_test.go similarity index 99% rename from internal/integration/payment/allinpay_test.go rename to internal/modules/system/integration/payment/allinpay_test.go index 7a09ce6..7ffae14 100644 --- a/internal/integration/payment/allinpay_test.go +++ b/internal/modules/system/integration/payment/allinpay_test.go @@ -18,7 +18,7 @@ import ( "strings" "testing" - "kra/internal/biz" + "kra/internal/modules/system/biz" "github.com/go-pay/gopay" "github.com/go-pay/gopay/allinpay" diff --git a/internal/integration/payment/apple.go b/internal/modules/system/integration/payment/apple.go similarity index 99% rename from internal/integration/payment/apple.go rename to internal/modules/system/integration/payment/apple.go index c62e1c7..54a5d48 100644 --- a/internal/integration/payment/apple.go +++ b/internal/modules/system/integration/payment/apple.go @@ -8,7 +8,7 @@ import ( "math" "strings" - "kra/internal/biz" + "kra/internal/modules/system/biz" gopayApple "github.com/go-pay/gopay/apple" "github.com/google/uuid" diff --git a/internal/integration/payment/apple_jws.go b/internal/modules/system/integration/payment/apple_jws.go similarity index 100% rename from internal/integration/payment/apple_jws.go rename to internal/modules/system/integration/payment/apple_jws.go diff --git a/internal/integration/payment/apple_jws_test.go b/internal/modules/system/integration/payment/apple_jws_test.go similarity index 100% rename from internal/integration/payment/apple_jws_test.go rename to internal/modules/system/integration/payment/apple_jws_test.go diff --git a/internal/integration/payment/douyin.go b/internal/modules/system/integration/payment/douyin.go similarity index 99% rename from internal/integration/payment/douyin.go rename to internal/modules/system/integration/payment/douyin.go index 748d187..f237a48 100644 --- a/internal/integration/payment/douyin.go +++ b/internal/modules/system/integration/payment/douyin.go @@ -7,7 +7,7 @@ import ( "fmt" "strings" - "kra/internal/biz" + "kra/internal/modules/system/biz" "github.com/go-pay/gopay" "github.com/go-pay/gopay/douyin" diff --git a/internal/integration/payment/gopay.go b/internal/modules/system/integration/payment/gopay.go similarity index 100% rename from internal/integration/payment/gopay.go rename to internal/modules/system/integration/payment/gopay.go diff --git a/internal/integration/payment/gopay_helpers.go b/internal/modules/system/integration/payment/gopay_helpers.go similarity index 99% rename from internal/integration/payment/gopay_helpers.go rename to internal/modules/system/integration/payment/gopay_helpers.go index 62bfd80..1ba0678 100644 --- a/internal/integration/payment/gopay_helpers.go +++ b/internal/modules/system/integration/payment/gopay_helpers.go @@ -7,7 +7,7 @@ import ( "net/http" "strings" - "kra/internal/biz" + "kra/internal/modules/system/biz" "github.com/go-pay/gopay" "github.com/go-pay/gopay/douyin" diff --git a/internal/integration/payment/gopay_test.go b/internal/modules/system/integration/payment/gopay_test.go similarity index 99% rename from internal/integration/payment/gopay_test.go rename to internal/modules/system/integration/payment/gopay_test.go index c3e92f8..efe9638 100644 --- a/internal/integration/payment/gopay_test.go +++ b/internal/modules/system/integration/payment/gopay_test.go @@ -20,8 +20,8 @@ import ( "strings" "testing" - "kra/internal/biz" - "kra/internal/utils/paymentutil" + "kra/internal/modules/system/biz" + "kra/internal/modules/system/utils/paymentutil" gopayAlipay "github.com/go-pay/gopay/alipay" gopayDouyin "github.com/go-pay/gopay/douyin" diff --git a/internal/integration/payment/identity_test.go b/internal/modules/system/integration/payment/identity_test.go similarity index 99% rename from internal/integration/payment/identity_test.go rename to internal/modules/system/integration/payment/identity_test.go index 31b6cb7..73919fc 100644 --- a/internal/integration/payment/identity_test.go +++ b/internal/modules/system/integration/payment/identity_test.go @@ -18,7 +18,7 @@ import ( "strings" "testing" - "kra/internal/biz" + "kra/internal/modules/system/biz" "github.com/go-pay/gopay" "github.com/go-pay/gopay/allinpay" diff --git a/internal/integration/payment/lakala.go b/internal/modules/system/integration/payment/lakala.go similarity index 99% rename from internal/integration/payment/lakala.go rename to internal/modules/system/integration/payment/lakala.go index 6eae7a3..d5faa55 100644 --- a/internal/integration/payment/lakala.go +++ b/internal/modules/system/integration/payment/lakala.go @@ -6,7 +6,7 @@ import ( "fmt" "strings" - "kra/internal/biz" + "kra/internal/modules/system/biz" "github.com/go-pay/gopay" "github.com/go-pay/gopay/lakala" diff --git a/internal/integration/payment/lakala_test.go b/internal/modules/system/integration/payment/lakala_test.go similarity index 99% rename from internal/integration/payment/lakala_test.go rename to internal/modules/system/integration/payment/lakala_test.go index 2972435..39faaa1 100644 --- a/internal/integration/payment/lakala_test.go +++ b/internal/modules/system/integration/payment/lakala_test.go @@ -3,7 +3,7 @@ package payment import ( "testing" - "kra/internal/biz" + "kra/internal/modules/system/biz" "github.com/go-pay/gopay/lakala" ) diff --git a/internal/integration/payment/native_test.go b/internal/modules/system/integration/payment/native_test.go similarity index 99% rename from internal/integration/payment/native_test.go rename to internal/modules/system/integration/payment/native_test.go index 2c488da..462fb73 100644 --- a/internal/integration/payment/native_test.go +++ b/internal/modules/system/integration/payment/native_test.go @@ -8,7 +8,7 @@ import ( "strings" "testing" - "kra/internal/biz" + "kra/internal/modules/system/biz" ) func TestWechatV2SignOfficialStyle(t *testing.T) { diff --git a/internal/integration/payment/paypal.go b/internal/modules/system/integration/payment/paypal.go similarity index 99% rename from internal/integration/payment/paypal.go rename to internal/modules/system/integration/payment/paypal.go index 58c38d5..c4c9f97 100644 --- a/internal/integration/payment/paypal.go +++ b/internal/modules/system/integration/payment/paypal.go @@ -9,7 +9,7 @@ import ( "strconv" "strings" - "kra/internal/biz" + "kra/internal/modules/system/biz" "github.com/go-pay/gopay" "github.com/go-pay/gopay/paypal" diff --git a/internal/integration/payment/paypal_test.go b/internal/modules/system/integration/payment/paypal_test.go similarity index 99% rename from internal/integration/payment/paypal_test.go rename to internal/modules/system/integration/payment/paypal_test.go index a5c4c38..f355317 100644 --- a/internal/integration/payment/paypal_test.go +++ b/internal/modules/system/integration/payment/paypal_test.go @@ -8,7 +8,7 @@ import ( "strings" "testing" - "kra/internal/biz" + "kra/internal/modules/system/biz" "github.com/go-pay/gopay/paypal" ) diff --git a/internal/integration/payment/qq.go b/internal/modules/system/integration/payment/qq.go similarity index 99% rename from internal/integration/payment/qq.go rename to internal/modules/system/integration/payment/qq.go index 4477efb..b54474a 100644 --- a/internal/integration/payment/qq.go +++ b/internal/modules/system/integration/payment/qq.go @@ -7,7 +7,7 @@ import ( "fmt" "strings" - "kra/internal/biz" + "kra/internal/modules/system/biz" "github.com/go-pay/gopay" gopayQQ "github.com/go-pay/gopay/qq" diff --git a/internal/integration/payment/qq_test.go b/internal/modules/system/integration/payment/qq_test.go similarity index 98% rename from internal/integration/payment/qq_test.go rename to internal/modules/system/integration/payment/qq_test.go index 52abcc9..3b00be5 100644 --- a/internal/integration/payment/qq_test.go +++ b/internal/modules/system/integration/payment/qq_test.go @@ -11,8 +11,8 @@ import ( "net/http/httptest" "testing" - "kra/internal/biz" - "kra/internal/utils/paymentutil" + "kra/internal/modules/system/biz" + "kra/internal/modules/system/utils/paymentutil" "github.com/go-pay/gopay" gopayQQ "github.com/go-pay/gopay/qq" diff --git a/internal/integration/payment/refund_boundary_test.go b/internal/modules/system/integration/payment/refund_boundary_test.go similarity index 99% rename from internal/integration/payment/refund_boundary_test.go rename to internal/modules/system/integration/payment/refund_boundary_test.go index f098458..87f8cb8 100644 --- a/internal/integration/payment/refund_boundary_test.go +++ b/internal/modules/system/integration/payment/refund_boundary_test.go @@ -5,7 +5,7 @@ import ( "strings" "testing" - "kra/internal/biz" + "kra/internal/modules/system/biz" "github.com/go-pay/gopay" gopayQQ "github.com/go-pay/gopay/qq" diff --git a/internal/integration/payment/response_validation_test.go b/internal/modules/system/integration/payment/response_validation_test.go similarity index 99% rename from internal/integration/payment/response_validation_test.go rename to internal/modules/system/integration/payment/response_validation_test.go index 4a1bd13..0e406f9 100644 --- a/internal/integration/payment/response_validation_test.go +++ b/internal/modules/system/integration/payment/response_validation_test.go @@ -4,7 +4,7 @@ import ( "strings" "testing" - "kra/internal/biz" + "kra/internal/modules/system/biz" gopayAlipay "github.com/go-pay/gopay/alipay" "github.com/go-pay/gopay/douyin" diff --git a/internal/integration/payment/result.go b/internal/modules/system/integration/payment/result.go similarity index 98% rename from internal/integration/payment/result.go rename to internal/modules/system/integration/payment/result.go index cc15560..a0df671 100644 --- a/internal/integration/payment/result.go +++ b/internal/modules/system/integration/payment/result.go @@ -7,8 +7,8 @@ import ( "net/url" "strings" - "kra/internal/biz" - "kra/internal/utils/paymentutil" + "kra/internal/modules/system/biz" + "kra/internal/modules/system/utils/paymentutil" ) func callbackFields(callback *biz.PaymentCallback) map[string]string { diff --git a/internal/integration/payment/result_test.go b/internal/modules/system/integration/payment/result_test.go similarity index 92% rename from internal/integration/payment/result_test.go rename to internal/modules/system/integration/payment/result_test.go index bfb0812..ed301ff 100644 --- a/internal/integration/payment/result_test.go +++ b/internal/modules/system/integration/payment/result_test.go @@ -3,7 +3,7 @@ package payment import ( "testing" - "kra/internal/biz" + "kra/internal/modules/system/biz" ) func TestCallbackFieldsAcceptsCaseInsensitiveContentType(t *testing.T) { diff --git a/internal/integration/payment/saobei.go b/internal/modules/system/integration/payment/saobei.go similarity index 99% rename from internal/integration/payment/saobei.go rename to internal/modules/system/integration/payment/saobei.go index 7102a58..5fba22a 100644 --- a/internal/integration/payment/saobei.go +++ b/internal/modules/system/integration/payment/saobei.go @@ -7,7 +7,7 @@ import ( "strings" "time" - "kra/internal/biz" + "kra/internal/modules/system/biz" "github.com/go-pay/gopay" "github.com/go-pay/gopay/saobei" diff --git a/internal/integration/payment/saobei_test.go b/internal/modules/system/integration/payment/saobei_test.go similarity index 99% rename from internal/integration/payment/saobei_test.go rename to internal/modules/system/integration/payment/saobei_test.go index c58b8ff..558176d 100644 --- a/internal/integration/payment/saobei_test.go +++ b/internal/modules/system/integration/payment/saobei_test.go @@ -4,7 +4,7 @@ import ( "context" "testing" - "kra/internal/biz" + "kra/internal/modules/system/biz" "github.com/go-pay/gopay" "github.com/go-pay/gopay/saobei" diff --git a/internal/integration/payment/vendor.go b/internal/modules/system/integration/payment/vendor.go similarity index 99% rename from internal/integration/payment/vendor.go rename to internal/modules/system/integration/payment/vendor.go index 77d07a4..4a6dd11 100644 --- a/internal/integration/payment/vendor.go +++ b/internal/modules/system/integration/payment/vendor.go @@ -14,8 +14,8 @@ import ( "strings" "time" - "kra/internal/biz" - "kra/internal/utils/paymentutil" + "kra/internal/modules/system/biz" + "kra/internal/modules/system/utils/paymentutil" ) type vendorProfile string diff --git a/internal/integration/payment/vendor_test.go b/internal/modules/system/integration/payment/vendor_test.go similarity index 100% rename from internal/integration/payment/vendor_test.go rename to internal/modules/system/integration/payment/vendor_test.go diff --git a/internal/integration/payment/wechat_v2.go b/internal/modules/system/integration/payment/wechat_v2.go similarity index 99% rename from internal/integration/payment/wechat_v2.go rename to internal/modules/system/integration/payment/wechat_v2.go index 904b291..51a9f0d 100644 --- a/internal/integration/payment/wechat_v2.go +++ b/internal/modules/system/integration/payment/wechat_v2.go @@ -13,7 +13,7 @@ import ( "strings" "time" - "kra/internal/biz" + "kra/internal/modules/system/biz" "github.com/go-pay/gopay" "github.com/go-pay/gopay/pkg/xhttp" diff --git a/internal/integration/payment/wechat_v3.go b/internal/modules/system/integration/payment/wechat_v3.go similarity index 99% rename from internal/integration/payment/wechat_v3.go rename to internal/modules/system/integration/payment/wechat_v3.go index 9d49b55..f708b77 100644 --- a/internal/integration/payment/wechat_v3.go +++ b/internal/modules/system/integration/payment/wechat_v3.go @@ -13,7 +13,7 @@ import ( "strings" "time" - "kra/internal/biz" + "kra/internal/modules/system/biz" "github.com/go-pay/gopay" gopayWechatV3 "github.com/go-pay/gopay/wechat/v3" diff --git a/internal/integration/payment/wechat_v3_codepay_test.go b/internal/modules/system/integration/payment/wechat_v3_codepay_test.go similarity index 99% rename from internal/integration/payment/wechat_v3_codepay_test.go rename to internal/modules/system/integration/payment/wechat_v3_codepay_test.go index 64e6019..840b347 100644 --- a/internal/integration/payment/wechat_v3_codepay_test.go +++ b/internal/modules/system/integration/payment/wechat_v3_codepay_test.go @@ -9,7 +9,7 @@ import ( "strings" "testing" - "kra/internal/biz" + "kra/internal/modules/system/biz" gopayWechatV3 "github.com/go-pay/gopay/wechat/v3" ) diff --git a/internal/integration/payment/wechat_v3_douyin_refund_test.go b/internal/modules/system/integration/payment/wechat_v3_douyin_refund_test.go similarity index 99% rename from internal/integration/payment/wechat_v3_douyin_refund_test.go rename to internal/modules/system/integration/payment/wechat_v3_douyin_refund_test.go index 966c0b8..2ef5eaa 100644 --- a/internal/integration/payment/wechat_v3_douyin_refund_test.go +++ b/internal/modules/system/integration/payment/wechat_v3_douyin_refund_test.go @@ -5,7 +5,7 @@ import ( "strings" "testing" - "kra/internal/biz" + "kra/internal/modules/system/biz" gopayDouyin "github.com/go-pay/gopay/douyin" gopayWechatV3 "github.com/go-pay/gopay/wechat/v3" diff --git a/internal/integration/provider.go b/internal/modules/system/integration/provider.go similarity index 70% rename from internal/integration/provider.go rename to internal/modules/system/integration/provider.go index bffaa4a..0d02f84 100644 --- a/internal/integration/provider.go +++ b/internal/modules/system/integration/provider.go @@ -4,10 +4,10 @@ package integration import ( - "kra/internal/biz" - "kra/internal/integration/cache" - "kra/internal/integration/email" - "kra/internal/integration/storage" + "kra/internal/modules/system/biz" + "kra/internal/modules/system/integration/cache" + "kra/internal/modules/system/integration/email" + "kra/internal/modules/system/integration/storage" "github.com/google/wire" ) diff --git a/internal/integration/storage/aliyun_storage.go b/internal/modules/system/integration/storage/aliyun_storage.go similarity index 98% rename from internal/integration/storage/aliyun_storage.go rename to internal/modules/system/integration/storage/aliyun_storage.go index cd8b61a..7748720 100644 --- a/internal/integration/storage/aliyun_storage.go +++ b/internal/modules/system/integration/storage/aliyun_storage.go @@ -8,8 +8,8 @@ import ( "strings" "github.com/aliyun/aliyun-oss-go-sdk/oss" - "kra/internal/biz" "kra/internal/conf" + "kra/internal/modules/system/biz" ) type aliyunStorage struct { diff --git a/internal/integration/storage/aws_storage.go b/internal/modules/system/integration/storage/aws_storage.go similarity index 99% rename from internal/integration/storage/aws_storage.go rename to internal/modules/system/integration/storage/aws_storage.go index d355274..fcd3ed7 100644 --- a/internal/integration/storage/aws_storage.go +++ b/internal/modules/system/integration/storage/aws_storage.go @@ -12,8 +12,8 @@ import ( "github.com/aws/aws-sdk-go-v2/credentials" "github.com/aws/aws-sdk-go-v2/feature/s3/manager" "github.com/aws/aws-sdk-go-v2/service/s3" - "kra/internal/biz" "kra/internal/conf" + "kra/internal/modules/system/biz" ) type awsStorage struct { diff --git a/internal/integration/storage/compose.go b/internal/modules/system/integration/storage/compose.go similarity index 100% rename from internal/integration/storage/compose.go rename to internal/modules/system/integration/storage/compose.go diff --git a/internal/integration/storage/compose_test.go b/internal/modules/system/integration/storage/compose_test.go similarity index 100% rename from internal/integration/storage/compose_test.go rename to internal/modules/system/integration/storage/compose_test.go diff --git a/internal/integration/storage/huawei_storage.go b/internal/modules/system/integration/storage/huawei_storage.go similarity index 99% rename from internal/integration/storage/huawei_storage.go rename to internal/modules/system/integration/storage/huawei_storage.go index ebc1320..823ba02 100644 --- a/internal/integration/storage/huawei_storage.go +++ b/internal/modules/system/integration/storage/huawei_storage.go @@ -8,8 +8,8 @@ import ( "strings" "github.com/huaweicloud/huaweicloud-sdk-go-obs/obs" - "kra/internal/biz" "kra/internal/conf" + "kra/internal/modules/system/biz" ) type huaweiStorage struct { diff --git a/internal/integration/storage/local.go b/internal/modules/system/integration/storage/local.go similarity index 99% rename from internal/integration/storage/local.go rename to internal/modules/system/integration/storage/local.go index 7d83314..1eca0ad 100644 --- a/internal/integration/storage/local.go +++ b/internal/modules/system/integration/storage/local.go @@ -10,8 +10,8 @@ import ( "sort" "strings" - "kra/internal/biz" "kra/internal/conf" + "kra/internal/modules/system/biz" ) type fileStorage struct { diff --git a/internal/integration/storage/qiniu_storage.go b/internal/modules/system/integration/storage/qiniu_storage.go similarity index 99% rename from internal/integration/storage/qiniu_storage.go rename to internal/modules/system/integration/storage/qiniu_storage.go index debed10..d29497b 100644 --- a/internal/integration/storage/qiniu_storage.go +++ b/internal/modules/system/integration/storage/qiniu_storage.go @@ -12,8 +12,8 @@ import ( "github.com/qiniu/go-sdk/v7/auth/qbox" qstorage "github.com/qiniu/go-sdk/v7/storage" - "kra/internal/biz" "kra/internal/conf" + "kra/internal/modules/system/biz" ) type qiniuStorage struct { diff --git a/internal/integration/storage/reloadable.go b/internal/modules/system/integration/storage/reloadable.go similarity index 97% rename from internal/integration/storage/reloadable.go rename to internal/modules/system/integration/storage/reloadable.go index ea70b3d..f3221ff 100644 --- a/internal/integration/storage/reloadable.go +++ b/internal/modules/system/integration/storage/reloadable.go @@ -5,8 +5,8 @@ import ( "io" "sync" - "kra/internal/biz" "kra/internal/conf" + "kra/internal/modules/system/biz" ) type Reloadable struct { diff --git a/internal/integration/storage/s3_storage.go b/internal/modules/system/integration/storage/s3_storage.go similarity index 99% rename from internal/integration/storage/s3_storage.go rename to internal/modules/system/integration/storage/s3_storage.go index 4003229..cc33c4a 100644 --- a/internal/integration/storage/s3_storage.go +++ b/internal/modules/system/integration/storage/s3_storage.go @@ -10,8 +10,8 @@ import ( "github.com/minio/minio-go/v7" "github.com/minio/minio-go/v7/pkg/credentials" - "kra/internal/biz" "kra/internal/conf" + "kra/internal/modules/system/biz" ) type s3Storage struct { diff --git a/internal/integration/storage/tencent_storage.go b/internal/modules/system/integration/storage/tencent_storage.go similarity index 99% rename from internal/integration/storage/tencent_storage.go rename to internal/modules/system/integration/storage/tencent_storage.go index f04602e..3296764 100644 --- a/internal/integration/storage/tencent_storage.go +++ b/internal/modules/system/integration/storage/tencent_storage.go @@ -11,8 +11,8 @@ import ( "time" cos "github.com/tencentyun/cos-go-sdk-v5" - "kra/internal/biz" "kra/internal/conf" + "kra/internal/modules/system/biz" ) type tencentStorage struct { diff --git a/internal/routeinfo/metadata.go b/internal/modules/system/routeinfo/metadata.go similarity index 100% rename from internal/routeinfo/metadata.go rename to internal/modules/system/routeinfo/metadata.go diff --git a/internal/security/adminauth/token.go b/internal/modules/system/security/adminauth/token.go similarity index 100% rename from internal/security/adminauth/token.go rename to internal/modules/system/security/adminauth/token.go diff --git a/internal/service/access_control.go b/internal/modules/system/service/access_control.go similarity index 96% rename from internal/service/access_control.go rename to internal/modules/system/service/access_control.go index 220aace..b97d25c 100644 --- a/internal/service/access_control.go +++ b/internal/modules/system/service/access_control.go @@ -3,7 +3,7 @@ package service import ( "context" - "kra/internal/biz" + "kra/internal/modules/system/biz" ) type AccessControlService struct{ uc *biz.AccessControlUsecase } diff --git a/internal/service/announcement.go b/internal/modules/system/service/announcement.go similarity index 97% rename from internal/service/announcement.go rename to internal/modules/system/service/announcement.go index b85a727..b1477b8 100644 --- a/internal/service/announcement.go +++ b/internal/modules/system/service/announcement.go @@ -5,8 +5,8 @@ import ( "encoding/json" "time" - "kra/internal/biz" - "kra/internal/service/dto" + "kra/internal/modules/system/biz" + "kra/internal/modules/system/dto" ) type AnnouncementInput struct { diff --git a/internal/service/api.go b/internal/modules/system/service/api.go similarity index 98% rename from internal/service/api.go rename to internal/modules/system/service/api.go index 820be99..35bc2fe 100644 --- a/internal/service/api.go +++ b/internal/modules/system/service/api.go @@ -4,8 +4,8 @@ import ( "context" "strings" - "kra/internal/biz" - "kra/internal/service/dto" + "kra/internal/modules/system/biz" + "kra/internal/modules/system/dto" ) type APIService struct { diff --git a/internal/service/api_token.go b/internal/modules/system/service/api_token.go similarity index 96% rename from internal/service/api_token.go rename to internal/modules/system/service/api_token.go index 79d8b7d..0559c0f 100644 --- a/internal/service/api_token.go +++ b/internal/modules/system/service/api_token.go @@ -4,8 +4,8 @@ import ( "context" "time" - "kra/internal/biz" - "kra/internal/service/dto" + "kra/internal/modules/system/biz" + "kra/internal/modules/system/dto" ) type TokenService struct { diff --git a/internal/service/audit.go b/internal/modules/system/service/audit.go similarity index 98% rename from internal/service/audit.go rename to internal/modules/system/service/audit.go index 01fa45b..f266d6e 100644 --- a/internal/service/audit.go +++ b/internal/modules/system/service/audit.go @@ -3,8 +3,8 @@ package service import ( "context" - "kra/internal/biz" - "kra/internal/service/dto" + "kra/internal/modules/system/biz" + "kra/internal/modules/system/dto" ) type AuditService struct{ uc *biz.AuditUsecase } diff --git a/internal/service/audit_error.go b/internal/modules/system/service/audit_error.go similarity index 97% rename from internal/service/audit_error.go rename to internal/modules/system/service/audit_error.go index 01a86a4..4f55841 100644 --- a/internal/service/audit_error.go +++ b/internal/modules/system/service/audit_error.go @@ -4,8 +4,8 @@ import ( "context" "time" - "kra/internal/biz" - "kra/internal/service/dto" + "kra/internal/modules/system/biz" + "kra/internal/modules/system/dto" ) func errorDTO(v *biz.ErrorRecord) *dto.ErrorRecordResponse { diff --git a/internal/service/audit_log_file.go b/internal/modules/system/service/audit_log_file.go similarity index 95% rename from internal/service/audit_log_file.go rename to internal/modules/system/service/audit_log_file.go index be58959..b498c56 100644 --- a/internal/service/audit_log_file.go +++ b/internal/modules/system/service/audit_log_file.go @@ -3,8 +3,8 @@ package service import ( "context" - "kra/internal/biz" - "kra/internal/service/dto" + "kra/internal/modules/system/biz" + "kra/internal/modules/system/dto" ) type LogViewerService struct{ uc *biz.LogViewerUsecase } diff --git a/internal/service/authentication.go b/internal/modules/system/service/authentication.go similarity index 94% rename from internal/service/authentication.go rename to internal/modules/system/service/authentication.go index 0e2e28a..85a75aa 100644 --- a/internal/service/authentication.go +++ b/internal/modules/system/service/authentication.go @@ -3,8 +3,8 @@ package service import ( "context" - "kra/internal/biz" - "kra/internal/service/dto" + "kra/internal/modules/system/biz" + "kra/internal/modules/system/dto" ) type AuthService struct { diff --git a/internal/service/authority.go b/internal/modules/system/service/authority.go similarity index 97% rename from internal/service/authority.go rename to internal/modules/system/service/authority.go index 88b9196..4c8d2c0 100644 --- a/internal/service/authority.go +++ b/internal/modules/system/service/authority.go @@ -3,8 +3,8 @@ package service import ( "context" - "kra/internal/biz" - "kra/internal/service/dto" + "kra/internal/modules/system/biz" + "kra/internal/modules/system/dto" ) type AuthorityService struct{ uc *biz.AuthorityUsecase } diff --git a/internal/service/department.go b/internal/modules/system/service/department.go similarity index 97% rename from internal/service/department.go rename to internal/modules/system/service/department.go index f5d9402..1dc4f67 100644 --- a/internal/service/department.go +++ b/internal/modules/system/service/department.go @@ -3,8 +3,8 @@ package service import ( "context" - "kra/internal/biz" - "kra/internal/service/dto" + "kra/internal/modules/system/biz" + "kra/internal/modules/system/dto" ) type DepartmentService struct{ uc *biz.DepartmentUsecase } diff --git a/internal/service/department_test.go b/internal/modules/system/service/department_test.go similarity index 92% rename from internal/service/department_test.go rename to internal/modules/system/service/department_test.go index 1efc873..9ae3fc2 100644 --- a/internal/service/department_test.go +++ b/internal/modules/system/service/department_test.go @@ -3,7 +3,7 @@ package service import ( "testing" - "kra/internal/biz" + "kra/internal/modules/system/biz" ) func TestDepartmentResponsePreservesNilAndEmptyChildren(t *testing.T) { diff --git a/internal/service/dictionary.go b/internal/modules/system/service/dictionary.go similarity index 99% rename from internal/service/dictionary.go rename to internal/modules/system/service/dictionary.go index e4cbdc4..602d4f5 100644 --- a/internal/service/dictionary.go +++ b/internal/modules/system/service/dictionary.go @@ -3,8 +3,8 @@ package service import ( "context" - "kra/internal/biz" - "kra/internal/service/dto" + "kra/internal/modules/system/biz" + "kra/internal/modules/system/dto" ) type DictionaryService struct{ uc *biz.DictionaryUsecase } diff --git a/internal/service/dictionary_import.go b/internal/modules/system/service/dictionary_import.go similarity index 95% rename from internal/service/dictionary_import.go rename to internal/modules/system/service/dictionary_import.go index 57ecb7b..307d937 100644 --- a/internal/service/dictionary_import.go +++ b/internal/modules/system/service/dictionary_import.go @@ -5,8 +5,8 @@ import ( "encoding/json" "errors" - "kra/internal/biz" - "kra/internal/service/dto" + "kra/internal/modules/system/biz" + "kra/internal/modules/system/dto" ) func (s *DictionaryService) ImportDictionaryJSON(ctx context.Context, raw string) error { diff --git a/internal/service/dictionary_test.go b/internal/modules/system/service/dictionary_test.go similarity index 95% rename from internal/service/dictionary_test.go rename to internal/modules/system/service/dictionary_test.go index 7a49645..87d8e26 100644 --- a/internal/service/dictionary_test.go +++ b/internal/modules/system/service/dictionary_test.go @@ -4,7 +4,7 @@ import ( "context" "testing" - "kra/internal/biz" + "kra/internal/modules/system/biz" ) type dictionaryExportRepo struct { diff --git a/internal/service/email.go b/internal/modules/system/service/email.go similarity index 93% rename from internal/service/email.go rename to internal/modules/system/service/email.go index 3f8051a..638ebb3 100644 --- a/internal/service/email.go +++ b/internal/modules/system/service/email.go @@ -2,7 +2,7 @@ package service import ( "context" - "kra/internal/biz" + "kra/internal/modules/system/biz" ) type EmailService struct{ uc *biz.EmailUsecase } diff --git a/internal/service/export.go b/internal/modules/system/service/export.go similarity index 98% rename from internal/service/export.go rename to internal/modules/system/service/export.go index 04f2a40..a33ed2b 100644 --- a/internal/service/export.go +++ b/internal/modules/system/service/export.go @@ -7,8 +7,8 @@ import ( "strings" "time" - "kra/internal/biz" - "kra/internal/service/dto" + "kra/internal/modules/system/biz" + "kra/internal/modules/system/dto" "github.com/google/uuid" ) diff --git a/internal/service/export_excel.go b/internal/modules/system/service/export_excel.go similarity index 100% rename from internal/service/export_excel.go rename to internal/modules/system/service/export_excel.go diff --git a/internal/service/media.go b/internal/modules/system/service/media.go similarity index 98% rename from internal/service/media.go rename to internal/modules/system/service/media.go index 8d576d4..d329e4f 100644 --- a/internal/service/media.go +++ b/internal/modules/system/service/media.go @@ -4,8 +4,8 @@ import ( "context" "io" - "kra/internal/biz" - "kra/internal/service/dto" + "kra/internal/modules/system/biz" + "kra/internal/modules/system/dto" ) type MediaService struct { diff --git a/internal/service/media_upload.go b/internal/modules/system/service/media_upload.go similarity index 97% rename from internal/service/media_upload.go rename to internal/modules/system/service/media_upload.go index edae30d..ea14221 100644 --- a/internal/service/media_upload.go +++ b/internal/modules/system/service/media_upload.go @@ -4,7 +4,7 @@ import ( "context" "io" - "kra/internal/service/dto" + "kra/internal/modules/system/dto" ) func (s *MediaService) InitUpload(ctx context.Context, userID uint, name, hash string, size, chunkSize int64, total int) (*dto.InitUploadResponse, error) { diff --git a/internal/service/menu.go b/internal/modules/system/service/menu.go similarity index 99% rename from internal/service/menu.go rename to internal/modules/system/service/menu.go index 7e55c58..198ec0f 100644 --- a/internal/service/menu.go +++ b/internal/modules/system/service/menu.go @@ -3,8 +3,8 @@ package service import ( "context" - "kra/internal/biz" - "kra/internal/service/dto" + "kra/internal/modules/system/biz" + "kra/internal/modules/system/dto" ) type MenuService struct{ uc *biz.MenuUsecase } diff --git a/internal/service/menu_test.go b/internal/modules/system/service/menu_test.go similarity index 97% rename from internal/service/menu_test.go rename to internal/modules/system/service/menu_test.go index 3931d78..79acf3d 100644 --- a/internal/service/menu_test.go +++ b/internal/modules/system/service/menu_test.go @@ -5,8 +5,8 @@ import ( "testing" "time" - "kra/internal/biz" - "kra/internal/service/dto" + "kra/internal/modules/system/biz" + "kra/internal/modules/system/dto" ) func TestMenuDomainPreservesRelationIdentity(t *testing.T) { diff --git a/internal/service/parameter.go b/internal/modules/system/service/parameter.go similarity index 97% rename from internal/service/parameter.go rename to internal/modules/system/service/parameter.go index 9c0633a..2fa955e 100644 --- a/internal/service/parameter.go +++ b/internal/modules/system/service/parameter.go @@ -4,8 +4,8 @@ import ( "context" "time" - "kra/internal/biz" - "kra/internal/service/dto" + "kra/internal/modules/system/biz" + "kra/internal/modules/system/dto" ) type ParameterService struct{ uc *biz.ParameterUsecase } diff --git a/internal/service/payment.go b/internal/modules/system/service/payment.go similarity index 99% rename from internal/service/payment.go rename to internal/modules/system/service/payment.go index 8ae853b..4568246 100644 --- a/internal/service/payment.go +++ b/internal/modules/system/service/payment.go @@ -4,8 +4,8 @@ import ( "context" "errors" - "kra/internal/biz" - "kra/internal/service/dto" + "kra/internal/modules/system/biz" + "kra/internal/modules/system/dto" ) type PaymentService struct{ uc *biz.PaymentUsecase } diff --git a/internal/service/permission.go b/internal/modules/system/service/permission.go similarity index 95% rename from internal/service/permission.go rename to internal/modules/system/service/permission.go index eae7542..5afe964 100644 --- a/internal/service/permission.go +++ b/internal/modules/system/service/permission.go @@ -3,7 +3,7 @@ package service import ( "context" - "kra/internal/biz" + "kra/internal/modules/system/biz" ) type PermissionService struct{ uc *biz.PermissionUsecase } diff --git a/internal/service/position.go b/internal/modules/system/service/position.go similarity index 96% rename from internal/service/position.go rename to internal/modules/system/service/position.go index 35c1ee1..63b5ae0 100644 --- a/internal/service/position.go +++ b/internal/modules/system/service/position.go @@ -3,8 +3,8 @@ package service import ( "context" - "kra/internal/biz" - "kra/internal/service/dto" + "kra/internal/modules/system/biz" + "kra/internal/modules/system/dto" ) type PositionService struct{ uc *biz.PositionUsecase } diff --git a/internal/service/route_path.go b/internal/modules/system/service/route_path.go similarity index 100% rename from internal/service/route_path.go rename to internal/modules/system/service/route_path.go diff --git a/internal/service/route_path_test.go b/internal/modules/system/service/route_path_test.go similarity index 100% rename from internal/service/route_path_test.go rename to internal/modules/system/service/route_path_test.go diff --git a/internal/service/security.go b/internal/modules/system/service/security.go similarity index 97% rename from internal/service/security.go rename to internal/modules/system/service/security.go index 71b5550..67dca75 100644 --- a/internal/service/security.go +++ b/internal/modules/system/service/security.go @@ -4,8 +4,8 @@ import ( "context" "errors" - "kra/internal/biz" - "kra/internal/service/dto" + "kra/internal/modules/system/biz" + "kra/internal/modules/system/dto" ) type PasswordPolicyError struct{ Err error } diff --git a/internal/service/security_session.go b/internal/modules/system/service/security_session.go similarity index 98% rename from internal/service/security_session.go rename to internal/modules/system/service/security_session.go index 2473a32..97f2419 100644 --- a/internal/service/security_session.go +++ b/internal/modules/system/service/security_session.go @@ -4,7 +4,7 @@ import ( "context" "time" - "kra/internal/biz" + "kra/internal/modules/system/biz" ) type SecurityService struct { diff --git a/internal/service/service.go b/internal/modules/system/service/service.go similarity index 100% rename from internal/service/service.go rename to internal/modules/system/service/service.go diff --git a/internal/service/system.go b/internal/modules/system/service/system.go similarity index 92% rename from internal/service/system.go rename to internal/modules/system/service/system.go index 1857d6a..5edc4e3 100644 --- a/internal/service/system.go +++ b/internal/modules/system/service/system.go @@ -3,7 +3,7 @@ package service import ( "context" - "kra/internal/biz" + "kra/internal/modules/system/biz" ) type SystemConfigService struct { diff --git a/internal/service/system_config.go b/internal/modules/system/service/system_config.go similarity index 94% rename from internal/service/system_config.go rename to internal/modules/system/service/system_config.go index e1806e9..0201336 100644 --- a/internal/service/system_config.go +++ b/internal/modules/system/service/system_config.go @@ -4,7 +4,7 @@ import ( "context" "encoding/json" - "kra/internal/service/dto" + "kra/internal/modules/system/dto" ) func (s *SystemConfigService) PersistConfig(ctx context.Context) error { diff --git a/internal/service/system_info.go b/internal/modules/system/service/system_info.go similarity index 97% rename from internal/service/system_info.go rename to internal/modules/system/service/system_info.go index 8cc810e..cba5569 100644 --- a/internal/service/system_info.go +++ b/internal/modules/system/service/system_info.go @@ -4,7 +4,7 @@ import ( "runtime" "time" - "kra/internal/service/dto" + "kra/internal/modules/system/dto" "github.com/shirou/gopsutil/v4/cpu" "github.com/shirou/gopsutil/v4/disk" diff --git a/internal/service/system_init.go b/internal/modules/system/service/system_init.go similarity index 92% rename from internal/service/system_init.go rename to internal/modules/system/service/system_init.go index 1246162..99efca2 100644 --- a/internal/service/system_init.go +++ b/internal/modules/system/service/system_init.go @@ -3,9 +3,9 @@ package service import ( "context" - "kra/internal/biz" - "kra/internal/routeinfo" - "kra/internal/service/dto" + "kra/internal/modules/system/biz" + "kra/internal/modules/system/dto" + "kra/internal/modules/system/routeinfo" ) func (s *SystemConfigService) Initialize(ctx context.Context, input *dto.DatabaseInitRequest, apis []*biz.API) error { diff --git a/internal/service/task.go b/internal/modules/system/service/task.go similarity index 98% rename from internal/service/task.go rename to internal/modules/system/service/task.go index 3de317e..2b326b6 100644 --- a/internal/service/task.go +++ b/internal/modules/system/service/task.go @@ -5,8 +5,8 @@ import ( "encoding/json" "time" - "kra/internal/biz" - "kra/internal/service/dto" + "kra/internal/modules/system/biz" + "kra/internal/modules/system/dto" ) type TaskService struct { diff --git a/internal/service/user.go b/internal/modules/system/service/user.go similarity index 98% rename from internal/service/user.go rename to internal/modules/system/service/user.go index a34cde6..fd1c933 100644 --- a/internal/service/user.go +++ b/internal/modules/system/service/user.go @@ -3,8 +3,8 @@ package service import ( "context" - "kra/internal/biz" - "kra/internal/service/dto" + "kra/internal/modules/system/biz" + "kra/internal/modules/system/dto" ) type userInput struct { diff --git a/internal/service/user_conversion.go b/internal/modules/system/service/user_conversion.go similarity index 96% rename from internal/service/user_conversion.go rename to internal/modules/system/service/user_conversion.go index c6e3e00..6b141a8 100644 --- a/internal/service/user_conversion.go +++ b/internal/modules/system/service/user_conversion.go @@ -1,8 +1,8 @@ package service import ( - "kra/internal/biz" - "kra/internal/service/dto" + "kra/internal/modules/system/biz" + "kra/internal/modules/system/dto" ) func convertAuthority(value biz.Authority) *dto.AuthorityResponse { diff --git a/internal/service/version.go b/internal/modules/system/service/version.go similarity index 99% rename from internal/service/version.go rename to internal/modules/system/service/version.go index d551cac..721928c 100644 --- a/internal/service/version.go +++ b/internal/modules/system/service/version.go @@ -5,8 +5,8 @@ import ( "encoding/json" "time" - "kra/internal/biz" - "kra/internal/service/dto" + "kra/internal/modules/system/biz" + "kra/internal/modules/system/dto" ) type VersionService struct{ uc *biz.VersionUsecase } diff --git a/internal/server/handler/announcement.go b/internal/modules/system/transport/handler/announcement.go similarity index 96% rename from internal/server/handler/announcement.go rename to internal/modules/system/transport/handler/announcement.go index 319f19c..6dd8759 100644 --- a/internal/server/handler/announcement.go +++ b/internal/modules/system/transport/handler/announcement.go @@ -3,9 +3,9 @@ package handler import ( "time" - "kra/internal/server/httpx" - "kra/internal/service" - "kra/internal/service/dto" + "kra/internal/modules/system/dto" + "kra/internal/modules/system/service" + "kra/internal/modules/system/transport/httpx" "github.com/gin-gonic/gin" ) diff --git a/internal/server/handler/api.go b/internal/modules/system/transport/handler/api.go similarity index 98% rename from internal/server/handler/api.go rename to internal/modules/system/transport/handler/api.go index 3fd7391..f98ba06 100644 --- a/internal/server/handler/api.go +++ b/internal/modules/system/transport/handler/api.go @@ -1,9 +1,9 @@ package handler import ( - "kra/internal/server/httpx" - "kra/internal/service" - "kra/internal/service/dto" + "kra/internal/modules/system/dto" + "kra/internal/modules/system/service" + "kra/internal/modules/system/transport/httpx" "github.com/gin-gonic/gin" ) diff --git a/internal/server/handler/api_token.go b/internal/modules/system/transport/handler/api_token.go similarity index 92% rename from internal/server/handler/api_token.go rename to internal/modules/system/transport/handler/api_token.go index b88ce94..5498dde 100644 --- a/internal/server/handler/api_token.go +++ b/internal/modules/system/transport/handler/api_token.go @@ -1,9 +1,9 @@ package handler import ( - "kra/internal/server/httpx" - "kra/internal/service" - "kra/internal/service/dto" + "kra/internal/modules/system/dto" + "kra/internal/modules/system/service" + "kra/internal/modules/system/transport/httpx" "github.com/gin-gonic/gin" ) diff --git a/internal/server/handler/audit.go b/internal/modules/system/transport/handler/audit.go similarity index 98% rename from internal/server/handler/audit.go rename to internal/modules/system/transport/handler/audit.go index 489f93b..ea28531 100644 --- a/internal/server/handler/audit.go +++ b/internal/modules/system/transport/handler/audit.go @@ -6,10 +6,10 @@ import ( "strconv" "time" - "kra/internal/biz" - "kra/internal/server/httpx" - "kra/internal/service" - "kra/internal/service/dto" + "kra/internal/modules/system/biz" + "kra/internal/modules/system/dto" + "kra/internal/modules/system/service" + "kra/internal/modules/system/transport/httpx" "github.com/gin-gonic/gin" ) diff --git a/internal/server/handler/authority.go b/internal/modules/system/transport/handler/authority.go similarity index 97% rename from internal/server/handler/authority.go rename to internal/modules/system/transport/handler/authority.go index 168cf13..62362f4 100644 --- a/internal/server/handler/authority.go +++ b/internal/modules/system/transport/handler/authority.go @@ -1,9 +1,9 @@ package handler import ( - "kra/internal/server/httpx" - "kra/internal/service" - "kra/internal/service/dto" + "kra/internal/modules/system/dto" + "kra/internal/modules/system/service" + "kra/internal/modules/system/transport/httpx" "github.com/gin-gonic/gin" ) diff --git a/internal/server/handler/dictionary.go b/internal/modules/system/transport/handler/dictionary.go similarity index 98% rename from internal/server/handler/dictionary.go rename to internal/modules/system/transport/handler/dictionary.go index 9774894..a92abb0 100644 --- a/internal/server/handler/dictionary.go +++ b/internal/modules/system/transport/handler/dictionary.go @@ -3,9 +3,9 @@ package handler import ( "strconv" - "kra/internal/server/httpx" - "kra/internal/service" - "kra/internal/service/dto" + "kra/internal/modules/system/dto" + "kra/internal/modules/system/service" + "kra/internal/modules/system/transport/httpx" "github.com/gin-gonic/gin" ) diff --git a/internal/server/handler/email.go b/internal/modules/system/transport/handler/email.go similarity index 86% rename from internal/server/handler/email.go rename to internal/modules/system/transport/handler/email.go index a6d7bb6..e6cfe44 100644 --- a/internal/server/handler/email.go +++ b/internal/modules/system/transport/handler/email.go @@ -1,9 +1,9 @@ package handler import ( - "kra/internal/server/httpx" - "kra/internal/service" - "kra/internal/service/dto" + "kra/internal/modules/system/dto" + "kra/internal/modules/system/service" + "kra/internal/modules/system/transport/httpx" "github.com/gin-gonic/gin" ) diff --git a/internal/server/handler/export.go b/internal/modules/system/transport/handler/export.go similarity index 98% rename from internal/server/handler/export.go rename to internal/modules/system/transport/handler/export.go index 8ad8549..f42b883 100644 --- a/internal/server/handler/export.go +++ b/internal/modules/system/transport/handler/export.go @@ -6,9 +6,9 @@ import ( "net/url" "strings" - "kra/internal/server/httpx" - "kra/internal/service" - "kra/internal/service/dto" + "kra/internal/modules/system/dto" + "kra/internal/modules/system/service" + "kra/internal/modules/system/transport/httpx" "github.com/gin-gonic/gin" "github.com/google/uuid" diff --git a/internal/server/handler/export_test.go b/internal/modules/system/transport/handler/export_test.go similarity index 100% rename from internal/server/handler/export_test.go rename to internal/modules/system/transport/handler/export_test.go diff --git a/internal/server/handler/media.go b/internal/modules/system/transport/handler/media.go similarity index 97% rename from internal/server/handler/media.go rename to internal/modules/system/transport/handler/media.go index ac8bce8..dcdc5e9 100644 --- a/internal/server/handler/media.go +++ b/internal/modules/system/transport/handler/media.go @@ -5,10 +5,10 @@ import ( "net/http" "strconv" - "kra/internal/server/httpx" - servermiddleware "kra/internal/server/middleware" - "kra/internal/service" - "kra/internal/service/dto" + "kra/internal/modules/system/dto" + "kra/internal/modules/system/service" + "kra/internal/modules/system/transport/httpx" + servermiddleware "kra/internal/modules/system/transport/middleware" "github.com/gin-gonic/gin" ) diff --git a/internal/server/handler/menu.go b/internal/modules/system/transport/handler/menu.go similarity index 97% rename from internal/server/handler/menu.go rename to internal/modules/system/transport/handler/menu.go index 631b753..19f3d09 100644 --- a/internal/server/handler/menu.go +++ b/internal/modules/system/transport/handler/menu.go @@ -1,9 +1,9 @@ package handler import ( - "kra/internal/server/httpx" - "kra/internal/service" - "kra/internal/service/dto" + "kra/internal/modules/system/dto" + "kra/internal/modules/system/service" + "kra/internal/modules/system/transport/httpx" "github.com/gin-gonic/gin" ) diff --git a/internal/server/handler/navigation.go b/internal/modules/system/transport/handler/navigation.go similarity index 80% rename from internal/server/handler/navigation.go rename to internal/modules/system/transport/handler/navigation.go index 3668a4a..651e3fc 100644 --- a/internal/server/handler/navigation.go +++ b/internal/modules/system/transport/handler/navigation.go @@ -1,9 +1,9 @@ package handler import ( - "kra/internal/server/httpx" - "kra/internal/server/middleware" - "kra/internal/service" + "kra/internal/modules/system/service" + "kra/internal/modules/system/transport/httpx" + "kra/internal/modules/system/transport/middleware" "github.com/gin-gonic/gin" ) diff --git a/internal/server/handler/organization.go b/internal/modules/system/transport/handler/organization.go similarity index 98% rename from internal/server/handler/organization.go rename to internal/modules/system/transport/handler/organization.go index 0d435bb..ed04b9b 100644 --- a/internal/server/handler/organization.go +++ b/internal/modules/system/transport/handler/organization.go @@ -1,9 +1,9 @@ package handler import ( - "kra/internal/server/httpx" - "kra/internal/service" - "kra/internal/service/dto" + "kra/internal/modules/system/dto" + "kra/internal/modules/system/service" + "kra/internal/modules/system/transport/httpx" "github.com/gin-gonic/gin" ) diff --git a/internal/server/handler/parameter.go b/internal/modules/system/transport/handler/parameter.go similarity index 95% rename from internal/server/handler/parameter.go rename to internal/modules/system/transport/handler/parameter.go index e9920c5..8158754 100644 --- a/internal/server/handler/parameter.go +++ b/internal/modules/system/transport/handler/parameter.go @@ -1,9 +1,9 @@ package handler import ( - "kra/internal/server/httpx" - "kra/internal/service" - "kra/internal/service/dto" + "kra/internal/modules/system/dto" + "kra/internal/modules/system/service" + "kra/internal/modules/system/transport/httpx" "github.com/gin-gonic/gin" ) diff --git a/internal/server/handler/payment.go b/internal/modules/system/transport/handler/payment.go similarity index 96% rename from internal/server/handler/payment.go rename to internal/modules/system/transport/handler/payment.go index 41857bf..576973c 100644 --- a/internal/server/handler/payment.go +++ b/internal/modules/system/transport/handler/payment.go @@ -4,9 +4,9 @@ import ( "io" "net/http" - "kra/internal/server/httpx" - "kra/internal/service" - "kra/internal/service/dto" + "kra/internal/modules/system/dto" + "kra/internal/modules/system/service" + "kra/internal/modules/system/transport/httpx" "github.com/gin-gonic/gin" ) diff --git a/internal/server/handler/payment_test.go b/internal/modules/system/transport/handler/payment_test.go similarity index 95% rename from internal/server/handler/payment_test.go rename to internal/modules/system/transport/handler/payment_test.go index 6f0ed50..4b3a26f 100644 --- a/internal/server/handler/payment_test.go +++ b/internal/modules/system/transport/handler/payment_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/gin-gonic/gin" - "kra/internal/service/dto" + "kra/internal/modules/system/dto" ) func TestWritePaymentCallbackAckDoesNotExposeError(t *testing.T) { diff --git a/internal/server/handler/permission.go b/internal/modules/system/transport/handler/permission.go similarity index 91% rename from internal/server/handler/permission.go rename to internal/modules/system/transport/handler/permission.go index d2253e6..79834aa 100644 --- a/internal/server/handler/permission.go +++ b/internal/modules/system/transport/handler/permission.go @@ -1,9 +1,9 @@ package handler import ( - "kra/internal/server/httpx" - "kra/internal/service" - "kra/internal/service/dto" + "kra/internal/modules/system/dto" + "kra/internal/modules/system/service" + "kra/internal/modules/system/transport/httpx" "github.com/gin-gonic/gin" ) diff --git a/internal/server/handler/public.go b/internal/modules/system/transport/handler/public.go similarity index 97% rename from internal/server/handler/public.go rename to internal/modules/system/transport/handler/public.go index 7d7ff2c..4025730 100644 --- a/internal/server/handler/public.go +++ b/internal/modules/system/transport/handler/public.go @@ -7,10 +7,10 @@ import ( "strings" "time" - "kra/internal/biz" - "kra/internal/server/httpx" - "kra/internal/service" - "kra/internal/service/dto" + "kra/internal/modules/system/biz" + "kra/internal/modules/system/dto" + "kra/internal/modules/system/service" + "kra/internal/modules/system/transport/httpx" "github.com/gin-gonic/gin" "github.com/mojocn/base64Captcha" diff --git a/internal/server/handler/query.go b/internal/modules/system/transport/handler/query.go similarity index 100% rename from internal/server/handler/query.go rename to internal/modules/system/transport/handler/query.go diff --git a/internal/server/handler/session.go b/internal/modules/system/transport/handler/session.go similarity index 86% rename from internal/server/handler/session.go rename to internal/modules/system/transport/handler/session.go index 17219c4..193fc9e 100644 --- a/internal/server/handler/session.go +++ b/internal/modules/system/transport/handler/session.go @@ -1,8 +1,8 @@ package handler import ( - "kra/internal/server/httpx" - "kra/internal/service" + "kra/internal/modules/system/service" + "kra/internal/modules/system/transport/httpx" "github.com/gin-gonic/gin" ) diff --git a/internal/server/handler/set.go b/internal/modules/system/transport/handler/set.go similarity index 100% rename from internal/server/handler/set.go rename to internal/modules/system/transport/handler/set.go diff --git a/internal/server/handler/system_config.go b/internal/modules/system/transport/handler/system_config.go similarity index 94% rename from internal/server/handler/system_config.go rename to internal/modules/system/transport/handler/system_config.go index 44a61d7..182d96c 100644 --- a/internal/server/handler/system_config.go +++ b/internal/modules/system/transport/handler/system_config.go @@ -1,9 +1,9 @@ package handler import ( - "kra/internal/server/httpx" - "kra/internal/service" - "kra/internal/service/dto" + "kra/internal/modules/system/dto" + "kra/internal/modules/system/service" + "kra/internal/modules/system/transport/httpx" "github.com/gin-gonic/gin" ) diff --git a/internal/server/handler/task.go b/internal/modules/system/transport/handler/task.go similarity index 96% rename from internal/server/handler/task.go rename to internal/modules/system/transport/handler/task.go index 4abf861..96845cd 100644 --- a/internal/server/handler/task.go +++ b/internal/modules/system/transport/handler/task.go @@ -5,10 +5,10 @@ import ( "net/http" "time" - "kra/internal/server/httpx" - "kra/internal/server/middleware" - "kra/internal/service" - "kra/internal/service/dto" + "kra/internal/modules/system/dto" + "kra/internal/modules/system/service" + "kra/internal/modules/system/transport/httpx" + "kra/internal/modules/system/transport/middleware" "github.com/gin-gonic/gin" ) diff --git a/internal/server/handler/user.go b/internal/modules/system/transport/handler/user.go similarity index 97% rename from internal/server/handler/user.go rename to internal/modules/system/transport/handler/user.go index c8e67d7..ac81a44 100644 --- a/internal/server/handler/user.go +++ b/internal/modules/system/transport/handler/user.go @@ -4,10 +4,10 @@ import ( "strconv" "time" - "kra/internal/server/httpx" - "kra/internal/server/middleware" - "kra/internal/service" - "kra/internal/service/dto" + "kra/internal/modules/system/dto" + "kra/internal/modules/system/service" + "kra/internal/modules/system/transport/httpx" + "kra/internal/modules/system/transport/middleware" "github.com/gin-gonic/gin" ) diff --git a/internal/server/handler/version.go b/internal/modules/system/transport/handler/version.go similarity index 96% rename from internal/server/handler/version.go rename to internal/modules/system/transport/handler/version.go index c38a185..1b027df 100644 --- a/internal/server/handler/version.go +++ b/internal/modules/system/transport/handler/version.go @@ -7,10 +7,10 @@ import ( "strconv" "time" - "kra/internal/biz" - "kra/internal/server/httpx" - "kra/internal/service" - "kra/internal/service/dto" + "kra/internal/modules/system/biz" + "kra/internal/modules/system/dto" + "kra/internal/modules/system/service" + "kra/internal/modules/system/transport/httpx" "github.com/gin-gonic/gin" ) diff --git a/internal/server/httpx/cookie.go b/internal/modules/system/transport/httpx/cookie.go similarity index 100% rename from internal/server/httpx/cookie.go rename to internal/modules/system/transport/httpx/cookie.go diff --git a/internal/server/httpx/response.go b/internal/modules/system/transport/httpx/response.go similarity index 100% rename from internal/server/httpx/response.go rename to internal/modules/system/transport/httpx/response.go diff --git a/internal/server/middleware/access.go b/internal/modules/system/transport/middleware/access.go similarity index 92% rename from internal/server/middleware/access.go rename to internal/modules/system/transport/middleware/access.go index 4d50413..f28ddef 100644 --- a/internal/server/middleware/access.go +++ b/internal/modules/system/transport/middleware/access.go @@ -3,10 +3,10 @@ package middleware import ( "context" - "kra/internal/biz" "kra/internal/conf" - "kra/internal/server/httpx" - "kra/internal/service" + "kra/internal/modules/system/biz" + "kra/internal/modules/system/service" + "kra/internal/modules/system/transport/httpx" "github.com/gin-gonic/gin" ) diff --git a/internal/server/middleware/access_log.go b/internal/modules/system/transport/middleware/access_log.go similarity index 98% rename from internal/server/middleware/access_log.go rename to internal/modules/system/transport/middleware/access_log.go index a8fdeb0..81c8398 100644 --- a/internal/server/middleware/access_log.go +++ b/internal/modules/system/transport/middleware/access_log.go @@ -9,9 +9,9 @@ import ( "strings" "time" - "kra/internal/biz" "kra/internal/conf" - "kra/internal/server/httpx" + "kra/internal/modules/system/biz" + "kra/internal/modules/system/transport/httpx" "github.com/gin-gonic/gin" ) diff --git a/internal/server/middleware/access_log_test.go b/internal/modules/system/transport/middleware/access_log_test.go similarity index 100% rename from internal/server/middleware/access_log_test.go rename to internal/modules/system/transport/middleware/access_log_test.go diff --git a/internal/server/middleware/access_test.go b/internal/modules/system/transport/middleware/access_test.go similarity index 97% rename from internal/server/middleware/access_test.go rename to internal/modules/system/transport/middleware/access_test.go index 68c94a6..8a2d5b6 100644 --- a/internal/server/middleware/access_test.go +++ b/internal/modules/system/transport/middleware/access_test.go @@ -8,8 +8,8 @@ import ( "strings" "testing" - "kra/internal/biz" "kra/internal/conf" + "kra/internal/modules/system/biz" "github.com/gin-gonic/gin" ) diff --git a/internal/server/middleware/audit.go b/internal/modules/system/transport/middleware/audit.go similarity index 99% rename from internal/server/middleware/audit.go rename to internal/modules/system/transport/middleware/audit.go index da1c9b0..3684759 100644 --- a/internal/server/middleware/audit.go +++ b/internal/modules/system/transport/middleware/audit.go @@ -13,8 +13,8 @@ import ( "time" "kra/internal/conf" - "kra/internal/service" - "kra/internal/service/dto" + "kra/internal/modules/system/dto" + "kra/internal/modules/system/service" "github.com/gin-gonic/gin" ) diff --git a/internal/server/middleware/auth.go b/internal/modules/system/transport/middleware/auth.go similarity index 95% rename from internal/server/middleware/auth.go rename to internal/modules/system/transport/middleware/auth.go index 7ab8f3a..149c0ae 100644 --- a/internal/server/middleware/auth.go +++ b/internal/modules/system/transport/middleware/auth.go @@ -6,9 +6,9 @@ import ( "strconv" "strings" - "kra/internal/biz" - "kra/internal/server/httpx" - "kra/internal/service" + "kra/internal/modules/system/biz" + "kra/internal/modules/system/service" + "kra/internal/modules/system/transport/httpx" "github.com/gin-gonic/gin" "golang.org/x/sync/singleflight" diff --git a/internal/server/middleware/capture.go b/internal/modules/system/transport/middleware/capture.go similarity index 100% rename from internal/server/middleware/capture.go rename to internal/modules/system/transport/middleware/capture.go diff --git a/internal/server/middleware/cors.go b/internal/modules/system/transport/middleware/cors.go similarity index 100% rename from internal/server/middleware/cors.go rename to internal/modules/system/transport/middleware/cors.go diff --git a/internal/server/middleware/cors_test.go b/internal/modules/system/transport/middleware/cors_test.go similarity index 100% rename from internal/server/middleware/cors_test.go rename to internal/modules/system/transport/middleware/cors_test.go diff --git a/internal/server/middleware/error_audit.go b/internal/modules/system/transport/middleware/error_audit.go similarity index 98% rename from internal/server/middleware/error_audit.go rename to internal/modules/system/transport/middleware/error_audit.go index f4a81fc..2239ac2 100644 --- a/internal/server/middleware/error_audit.go +++ b/internal/modules/system/transport/middleware/error_audit.go @@ -6,7 +6,7 @@ import ( "log/slog" "strings" - "kra/internal/server/httpx" + "kra/internal/modules/system/transport/httpx" "github.com/gin-gonic/gin" ) diff --git a/internal/server/middleware/error_audit_test.go b/internal/modules/system/transport/middleware/error_audit_test.go similarity index 100% rename from internal/server/middleware/error_audit_test.go rename to internal/modules/system/transport/middleware/error_audit_test.go diff --git a/internal/server/middleware/rate_limit.go b/internal/modules/system/transport/middleware/rate_limit.go similarity index 93% rename from internal/server/middleware/rate_limit.go rename to internal/modules/system/transport/middleware/rate_limit.go index e4c3994..93e1334 100644 --- a/internal/server/middleware/rate_limit.go +++ b/internal/modules/system/transport/middleware/rate_limit.go @@ -5,8 +5,8 @@ import ( "strings" "time" - "kra/internal/server/httpx" - "kra/internal/service" + "kra/internal/modules/system/service" + "kra/internal/modules/system/transport/httpx" "github.com/gin-gonic/gin" ) diff --git a/internal/server/middleware/rate_limit_test.go b/internal/modules/system/transport/middleware/rate_limit_test.go similarity index 97% rename from internal/server/middleware/rate_limit_test.go rename to internal/modules/system/transport/middleware/rate_limit_test.go index 8a1afff..38b15e0 100644 --- a/internal/server/middleware/rate_limit_test.go +++ b/internal/modules/system/transport/middleware/rate_limit_test.go @@ -9,8 +9,8 @@ import ( "testing" "time" - "kra/internal/biz" - "kra/internal/service" + "kra/internal/modules/system/biz" + "kra/internal/modules/system/service" "github.com/gin-gonic/gin" ) diff --git a/internal/server/middleware/recovery.go b/internal/modules/system/transport/middleware/recovery.go similarity index 100% rename from internal/server/middleware/recovery.go rename to internal/modules/system/transport/middleware/recovery.go diff --git a/internal/server/middleware/request.go b/internal/modules/system/transport/middleware/request.go similarity index 100% rename from internal/server/middleware/request.go rename to internal/modules/system/transport/middleware/request.go diff --git a/internal/server/router/announcement.go b/internal/modules/system/transport/router/announcement.go similarity index 92% rename from internal/server/router/announcement.go rename to internal/modules/system/transport/router/announcement.go index c71f715..1c9fd9b 100644 --- a/internal/server/router/announcement.go +++ b/internal/modules/system/transport/router/announcement.go @@ -1,7 +1,7 @@ package router import ( - "kra/internal/server/handler" + "kra/internal/modules/system/transport/handler" "github.com/gin-gonic/gin" ) diff --git a/internal/server/router/api.go b/internal/modules/system/transport/router/api.go similarity index 94% rename from internal/server/router/api.go rename to internal/modules/system/transport/router/api.go index 13b3e6f..e8c4279 100644 --- a/internal/server/router/api.go +++ b/internal/modules/system/transport/router/api.go @@ -1,7 +1,7 @@ package router import ( - "kra/internal/server/handler" + "kra/internal/modules/system/transport/handler" "github.com/gin-gonic/gin" ) diff --git a/internal/server/router/api_token.go b/internal/modules/system/transport/router/api_token.go similarity index 86% rename from internal/server/router/api_token.go rename to internal/modules/system/transport/router/api_token.go index 4ad9d09..2962b30 100644 --- a/internal/server/router/api_token.go +++ b/internal/modules/system/transport/router/api_token.go @@ -1,7 +1,7 @@ package router import ( - "kra/internal/server/handler" + "kra/internal/modules/system/transport/handler" "github.com/gin-gonic/gin" ) diff --git a/internal/server/router/audit.go b/internal/modules/system/transport/router/audit.go similarity index 96% rename from internal/server/router/audit.go rename to internal/modules/system/transport/router/audit.go index e526700..842a7a2 100644 --- a/internal/server/router/audit.go +++ b/internal/modules/system/transport/router/audit.go @@ -1,7 +1,7 @@ package router import ( - "kra/internal/server/handler" + "kra/internal/modules/system/transport/handler" "github.com/gin-gonic/gin" ) diff --git a/internal/server/router/authority.go b/internal/modules/system/transport/router/authority.go similarity index 92% rename from internal/server/router/authority.go rename to internal/modules/system/transport/router/authority.go index f904d40..91bc7ec 100644 --- a/internal/server/router/authority.go +++ b/internal/modules/system/transport/router/authority.go @@ -1,7 +1,7 @@ package router import ( - "kra/internal/server/handler" + "kra/internal/modules/system/transport/handler" "github.com/gin-gonic/gin" ) diff --git a/internal/server/router/dictionary.go b/internal/modules/system/transport/router/dictionary.go similarity index 96% rename from internal/server/router/dictionary.go rename to internal/modules/system/transport/router/dictionary.go index f4c5cd1..ea405f6 100644 --- a/internal/server/router/dictionary.go +++ b/internal/modules/system/transport/router/dictionary.go @@ -1,7 +1,7 @@ package router import ( - "kra/internal/server/handler" + "kra/internal/modules/system/transport/handler" "github.com/gin-gonic/gin" ) diff --git a/internal/server/router/email.go b/internal/modules/system/transport/router/email.go similarity index 81% rename from internal/server/router/email.go rename to internal/modules/system/transport/router/email.go index b1d748e..804e556 100644 --- a/internal/server/router/email.go +++ b/internal/modules/system/transport/router/email.go @@ -1,7 +1,7 @@ package router import ( - "kra/internal/server/handler" + "kra/internal/modules/system/transport/handler" "github.com/gin-gonic/gin" ) diff --git a/internal/server/router/export.go b/internal/modules/system/transport/router/export.go similarity index 94% rename from internal/server/router/export.go rename to internal/modules/system/transport/router/export.go index 1d4c563..bd9377f 100644 --- a/internal/server/router/export.go +++ b/internal/modules/system/transport/router/export.go @@ -1,7 +1,7 @@ package router import ( - "kra/internal/server/handler" + "kra/internal/modules/system/transport/handler" "github.com/gin-gonic/gin" ) diff --git a/internal/server/router/media.go b/internal/modules/system/transport/router/media.go similarity index 94% rename from internal/server/router/media.go rename to internal/modules/system/transport/router/media.go index 67cbf4a..dc73366 100644 --- a/internal/server/router/media.go +++ b/internal/modules/system/transport/router/media.go @@ -1,7 +1,7 @@ package router import ( - "kra/internal/server/handler" + "kra/internal/modules/system/transport/handler" "github.com/gin-gonic/gin" ) diff --git a/internal/server/router/menu.go b/internal/modules/system/transport/router/menu.go similarity index 92% rename from internal/server/router/menu.go rename to internal/modules/system/transport/router/menu.go index d1a93c6..afd9eda 100644 --- a/internal/server/router/menu.go +++ b/internal/modules/system/transport/router/menu.go @@ -1,7 +1,7 @@ package router import ( - "kra/internal/server/handler" + "kra/internal/modules/system/transport/handler" "github.com/gin-gonic/gin" ) diff --git a/internal/server/router/organization.go b/internal/modules/system/transport/router/organization.go similarity index 95% rename from internal/server/router/organization.go rename to internal/modules/system/transport/router/organization.go index 5f445d2..6e39c6c 100644 --- a/internal/server/router/organization.go +++ b/internal/modules/system/transport/router/organization.go @@ -1,7 +1,7 @@ package router import ( - "kra/internal/server/handler" + "kra/internal/modules/system/transport/handler" "github.com/gin-gonic/gin" ) diff --git a/internal/server/router/parameter.go b/internal/modules/system/transport/router/parameter.go similarity index 91% rename from internal/server/router/parameter.go rename to internal/modules/system/transport/router/parameter.go index c117ba4..df86ed1 100644 --- a/internal/server/router/parameter.go +++ b/internal/modules/system/transport/router/parameter.go @@ -1,7 +1,7 @@ package router import ( - "kra/internal/server/handler" + "kra/internal/modules/system/transport/handler" "github.com/gin-gonic/gin" ) diff --git a/internal/server/router/payment.go b/internal/modules/system/transport/router/payment.go similarity index 90% rename from internal/server/router/payment.go rename to internal/modules/system/transport/router/payment.go index 3e18157..6a5e904 100644 --- a/internal/server/router/payment.go +++ b/internal/modules/system/transport/router/payment.go @@ -2,7 +2,7 @@ package router import ( "github.com/gin-gonic/gin" - "kra/internal/server/handler" + "kra/internal/modules/system/transport/handler" ) func RegisterPayment(group, public *gin.RouterGroup, h *handler.Payment) { diff --git a/internal/server/router/permission.go b/internal/modules/system/transport/router/permission.go similarity index 86% rename from internal/server/router/permission.go rename to internal/modules/system/transport/router/permission.go index bb960fd..f94ca84 100644 --- a/internal/server/router/permission.go +++ b/internal/modules/system/transport/router/permission.go @@ -1,7 +1,7 @@ package router import ( - "kra/internal/server/handler" + "kra/internal/modules/system/transport/handler" "github.com/gin-gonic/gin" ) diff --git a/internal/server/router/public.go b/internal/modules/system/transport/router/public.go similarity index 88% rename from internal/server/router/public.go rename to internal/modules/system/transport/router/public.go index 2e1be19..758dd5a 100644 --- a/internal/server/router/public.go +++ b/internal/modules/system/transport/router/public.go @@ -1,7 +1,7 @@ package router import ( - "kra/internal/server/handler" + "kra/internal/modules/system/transport/handler" "github.com/gin-gonic/gin" ) diff --git a/internal/server/router/system_config.go b/internal/modules/system/transport/router/system_config.go similarity index 91% rename from internal/server/router/system_config.go rename to internal/modules/system/transport/router/system_config.go index 0f49979..43c18bc 100644 --- a/internal/server/router/system_config.go +++ b/internal/modules/system/transport/router/system_config.go @@ -1,7 +1,7 @@ package router import ( - "kra/internal/server/handler" + "kra/internal/modules/system/transport/handler" "github.com/gin-gonic/gin" ) diff --git a/internal/server/router/task.go b/internal/modules/system/transport/router/task.go similarity index 91% rename from internal/server/router/task.go rename to internal/modules/system/transport/router/task.go index 7be9f1d..dafa329 100644 --- a/internal/server/router/task.go +++ b/internal/modules/system/transport/router/task.go @@ -1,7 +1,7 @@ package router import ( - "kra/internal/server/handler" + "kra/internal/modules/system/transport/handler" "github.com/gin-gonic/gin" ) diff --git a/internal/server/router/user.go b/internal/modules/system/transport/router/user.go similarity index 95% rename from internal/server/router/user.go rename to internal/modules/system/transport/router/user.go index 6b98ca8..5231121 100644 --- a/internal/server/router/user.go +++ b/internal/modules/system/transport/router/user.go @@ -1,7 +1,7 @@ package router import ( - "kra/internal/server/handler" + "kra/internal/modules/system/transport/handler" "github.com/gin-gonic/gin" ) diff --git a/internal/server/router/version.go b/internal/modules/system/transport/router/version.go similarity index 90% rename from internal/server/router/version.go rename to internal/modules/system/transport/router/version.go index 50289cc..ad3eaf4 100644 --- a/internal/server/router/version.go +++ b/internal/modules/system/transport/router/version.go @@ -1,7 +1,7 @@ package router import ( - "kra/internal/server/handler" + "kra/internal/modules/system/transport/handler" "github.com/gin-gonic/gin" ) diff --git a/internal/server/gin.go b/internal/modules/system/transport/server/gin.go similarity index 96% rename from internal/server/gin.go rename to internal/modules/system/transport/server/gin.go index 4c93457..6d18932 100644 --- a/internal/server/gin.go +++ b/internal/modules/system/transport/server/gin.go @@ -11,11 +11,11 @@ import ( "time" "kra/internal/conf" - "kra/internal/server/handler" - "kra/internal/server/httpx" - servermiddleware "kra/internal/server/middleware" - serverrouter "kra/internal/server/router" - "kra/internal/service" + "kra/internal/modules/system/service" + "kra/internal/modules/system/transport/handler" + "kra/internal/modules/system/transport/httpx" + servermiddleware "kra/internal/modules/system/transport/middleware" + serverrouter "kra/internal/modules/system/transport/router" "github.com/gin-gonic/gin" kratoshttp "github.com/go-kratos/kratos/v3/transport/http" diff --git a/internal/server/gin_test.go b/internal/modules/system/transport/server/gin_test.go similarity index 99% rename from internal/server/gin_test.go rename to internal/modules/system/transport/server/gin_test.go index c2655d2..8bbd43a 100644 --- a/internal/server/gin_test.go +++ b/internal/modules/system/transport/server/gin_test.go @@ -12,7 +12,7 @@ import ( "testing" "kra/internal/conf" - "kra/internal/server/handler" + "kra/internal/modules/system/transport/handler" "github.com/gin-gonic/gin" ) diff --git a/internal/server/server.go b/internal/modules/system/transport/server/server.go similarity index 92% rename from internal/server/server.go rename to internal/modules/system/transport/server/server.go index ce84f5a..714a93a 100644 --- a/internal/server/server.go +++ b/internal/modules/system/transport/server/server.go @@ -1,7 +1,7 @@ package server import ( - "kra/internal/server/handler" + "kra/internal/modules/system/transport/handler" "github.com/google/wire" ) diff --git a/internal/server/swagger.go b/internal/modules/system/transport/server/swagger.go similarity index 99% rename from internal/server/swagger.go rename to internal/modules/system/transport/server/swagger.go index 0d4bc39..ac02735 100644 --- a/internal/server/swagger.go +++ b/internal/modules/system/transport/server/swagger.go @@ -8,7 +8,7 @@ import ( "strings" "sync" - "kra/internal/routeinfo" + "kra/internal/modules/system/routeinfo" "github.com/gin-gonic/gin" swaggerFiles "github.com/swaggo/files" diff --git a/internal/utils/configutil/json.go b/internal/modules/system/utils/configutil/json.go similarity index 100% rename from internal/utils/configutil/json.go rename to internal/modules/system/utils/configutil/json.go diff --git a/internal/utils/configutil/json_test.go b/internal/modules/system/utils/configutil/json_test.go similarity index 100% rename from internal/utils/configutil/json_test.go rename to internal/modules/system/utils/configutil/json_test.go diff --git a/internal/utils/paymentutil/README.md b/internal/modules/system/utils/paymentutil/README.md similarity index 100% rename from internal/utils/paymentutil/README.md rename to internal/modules/system/utils/paymentutil/README.md diff --git a/internal/utils/paymentutil/amount.go b/internal/modules/system/utils/paymentutil/amount.go similarity index 100% rename from internal/utils/paymentutil/amount.go rename to internal/modules/system/utils/paymentutil/amount.go diff --git a/internal/utils/paymentutil/amount_test.go b/internal/modules/system/utils/paymentutil/amount_test.go similarity index 100% rename from internal/utils/paymentutil/amount_test.go rename to internal/modules/system/utils/paymentutil/amount_test.go diff --git a/internal/utils/paymentutil/json.go b/internal/modules/system/utils/paymentutil/json.go similarity index 100% rename from internal/utils/paymentutil/json.go rename to internal/modules/system/utils/paymentutil/json.go diff --git a/internal/utils/paymentutil/json_test.go b/internal/modules/system/utils/paymentutil/json_test.go similarity index 100% rename from internal/utils/paymentutil/json_test.go rename to internal/modules/system/utils/paymentutil/json_test.go diff --git a/internal/utils/paymentutil/signing.go b/internal/modules/system/utils/paymentutil/signing.go similarity index 100% rename from internal/utils/paymentutil/signing.go rename to internal/modules/system/utils/paymentutil/signing.go diff --git a/internal/utils/paymentutil/signing_test.go b/internal/modules/system/utils/paymentutil/signing_test.go similarity index 100% rename from internal/utils/paymentutil/signing_test.go rename to internal/modules/system/utils/paymentutil/signing_test.go diff --git a/internal/utils/paymentutil/status.go b/internal/modules/system/utils/paymentutil/status.go similarity index 100% rename from internal/utils/paymentutil/status.go rename to internal/modules/system/utils/paymentutil/status.go diff --git a/internal/utils/paymentutil/xml.go b/internal/modules/system/utils/paymentutil/xml.go similarity index 100% rename from internal/utils/paymentutil/xml.go rename to internal/modules/system/utils/paymentutil/xml.go diff --git a/internal/worker/task_executor.go b/internal/modules/system/worker/task_executor.go similarity index 99% rename from internal/worker/task_executor.go rename to internal/modules/system/worker/task_executor.go index 51d0f8e..85e39c5 100644 --- a/internal/worker/task_executor.go +++ b/internal/modules/system/worker/task_executor.go @@ -14,8 +14,8 @@ import ( "syscall" "time" - "kra/internal/biz" "kra/internal/conf" + "kra/internal/modules/system/biz" ) type TaskExecutor struct { diff --git a/internal/worker/task_executor_test.go b/internal/modules/system/worker/task_executor_test.go similarity index 98% rename from internal/worker/task_executor_test.go rename to internal/modules/system/worker/task_executor_test.go index b141aa0..e48477c 100644 --- a/internal/worker/task_executor_test.go +++ b/internal/modules/system/worker/task_executor_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "kra/internal/biz" + "kra/internal/modules/system/biz" ) func TestPrivateIP(t *testing.T) { diff --git a/internal/worker/task_registry.go b/internal/modules/system/worker/task_registry.go similarity index 96% rename from internal/worker/task_registry.go rename to internal/modules/system/worker/task_registry.go index e50a10d..a083a27 100644 --- a/internal/worker/task_registry.go +++ b/internal/modules/system/worker/task_registry.go @@ -4,7 +4,7 @@ import ( "context" "encoding/json" - "kra/internal/biz" + "kra/internal/modules/system/biz" ) // registerTaskMethods defines the in-process methods available to the task diff --git a/internal/worker/task_runtime_test.go b/internal/modules/system/worker/task_runtime_test.go similarity index 99% rename from internal/worker/task_runtime_test.go rename to internal/modules/system/worker/task_runtime_test.go index d016301..9fa260f 100644 --- a/internal/worker/task_runtime_test.go +++ b/internal/modules/system/worker/task_runtime_test.go @@ -11,7 +11,7 @@ import ( "testing" "time" - "kra/internal/biz" + "kra/internal/modules/system/biz" ) type workerTaskRepo struct { diff --git a/internal/worker/task_scheduler.go b/internal/modules/system/worker/task_scheduler.go similarity index 99% rename from internal/worker/task_scheduler.go rename to internal/modules/system/worker/task_scheduler.go index 66d3656..6753f20 100644 --- a/internal/worker/task_scheduler.go +++ b/internal/modules/system/worker/task_scheduler.go @@ -10,7 +10,7 @@ import ( "time" "github.com/robfig/cron/v3" - "kra/internal/biz" + "kra/internal/modules/system/biz" ) type TaskScheduler struct { diff --git a/internal/worker/task_scheduler_test.go b/internal/modules/system/worker/task_scheduler_test.go similarity index 100% rename from internal/worker/task_scheduler_test.go rename to internal/modules/system/worker/task_scheduler_test.go diff --git a/internal/worker/worker.go b/internal/modules/system/worker/worker.go similarity index 100% rename from internal/worker/worker.go rename to internal/modules/system/worker/worker.go diff --git a/internal/platform/README.md b/internal/platform/README.md new file mode 100644 index 0000000..eb1bae3 --- /dev/null +++ b/internal/platform/README.md @@ -0,0 +1,5 @@ +# Platform + +这里放跨业务模块的基础设施,不放具体业务表或业务用例。 + +当前包含 `database`:数据库驱动、连接生命周期、GORM 日志、分页和迁移执行器。 diff --git a/internal/data/gormkit/README.md b/internal/platform/database/gormkit/README.md similarity index 100% rename from internal/data/gormkit/README.md rename to internal/platform/database/gormkit/README.md diff --git a/internal/data/gormkit/logger.go b/internal/platform/database/gormkit/logger.go similarity index 100% rename from internal/data/gormkit/logger.go rename to internal/platform/database/gormkit/logger.go diff --git a/internal/platform/database/migration/runner.go b/internal/platform/database/migration/runner.go new file mode 100644 index 0000000..0bed148 --- /dev/null +++ b/internal/platform/database/migration/runner.go @@ -0,0 +1,121 @@ +// Package migration owns the application database migration runner. Each data +// module declares its own steps; the root data package only orders and runs +// them. +package migration + +import ( + "fmt" + "strings" + + "gorm.io/gorm" +) + +const TableName = "sys_schema_migrations" + +type Step struct { + ID string + Migrate func(*gorm.DB) error +} + +type record struct { + ID string `gorm:"primaryKey;size:255"` +} + +func (record) TableName() string { return TableName } + +func Run(db *gorm.DB, steps []Step) error { + if db == nil { + return fmt.Errorf("database is nil") + } + db = db.Session(&gorm.Session{NewDB: true}) + if err := repairMigrationTable(db); err != nil { + return err + } + if !db.Session(&gorm.Session{NewDB: true}).Migrator().HasTable(&record{}) { + if err := db.Session(&gorm.Session{NewDB: true}).Migrator().CreateTable(&record{}); err != nil { + return fmt.Errorf("create migration table: %w", err) + } + } + var appliedRows []record + if err := db.Session(&gorm.Session{NewDB: true}).Find(&appliedRows).Error; err != nil { + return fmt.Errorf("load applied migrations: %w", err) + } + applied := make(map[string]struct{}, len(appliedRows)) + known := make(map[string]struct{}, len(steps)) + for _, row := range appliedRows { + applied[row.ID] = struct{}{} + } + for _, step := range steps { + if step.ID == "" { + return fmt.Errorf("migration id is empty") + } + if _, duplicate := known[step.ID]; duplicate { + return fmt.Errorf("duplicate migration id %q", step.ID) + } + known[step.ID] = struct{}{} + } + for id := range applied { + if _, ok := known[id]; !ok { + return fmt.Errorf("unknown applied migration %q", id) + } + } + for _, step := range steps { + if _, ok := applied[step.ID]; ok { + continue + } + if step.Migrate == nil { + return fmt.Errorf("migration %q has no function", step.ID) + } + if err := step.Migrate(db.Session(&gorm.Session{NewDB: true})); err != nil { + return fmt.Errorf("apply migration %q: %w", step.ID, err) + } + if err := db.Session(&gorm.Session{NewDB: true}).Create(&record{ID: step.ID}).Error; err != nil { + return fmt.Errorf("record migration %q: %w", step.ID, err) + } + } + return nil +} + +func repairMigrationTable(db *gorm.DB) error { + clean := db.Session(&gorm.Session{NewDB: true}) + if !clean.Migrator().HasTable(TableName) { + return nil + } + var dataType string + switch clean.Dialector.Name() { + case "mysql": + err := clean.Raw("SELECT DATA_TYPE FROM information_schema.columns WHERE table_schema = DATABASE() AND table_name = ? AND column_name = ?", TableName, "id").Scan(&dataType).Error + if err != nil { + return fmt.Errorf("inspect migration table: %w", err) + } + case "postgres": + err := clean.Raw("SELECT data_type FROM information_schema.columns WHERE table_schema = current_schema() AND table_name = ? AND column_name = ?", TableName, "id").Scan(&dataType).Error + if err != nil { + return fmt.Errorf("inspect migration table: %w", err) + } + case "sqlite": + var rows []struct { + Name string `gorm:"column:name"` + Type string `gorm:"column:type"` + } + if err := clean.Raw("PRAGMA table_info(" + TableName + ")").Scan(&rows).Error; err != nil { + return fmt.Errorf("inspect migration table: %w", err) + } + for _, row := range rows { + if strings.EqualFold(row.Name, "id") { + dataType = row.Type + break + } + } + default: + return nil + } + normalized := strings.ToLower(dataType) + if strings.Contains(normalized, "char") || strings.Contains(normalized, "text") || strings.Contains(normalized, "clob") { + return nil + } + if err := clean.Migrator().DropTable(TableName); err != nil { + return fmt.Errorf("repair invalid migration table: %w", err) + } + return nil +} diff --git a/internal/platform/database/migration/schema.go b/internal/platform/database/migration/schema.go new file mode 100644 index 0000000..85411e5 --- /dev/null +++ b/internal/platform/database/migration/schema.go @@ -0,0 +1,20 @@ +package migration + +import "gorm.io/gorm" + +// CreateMissingTables creates only schemas that are absent. Existing tables +// are intentionally left untouched: GORM's MySQL column diff path can panic +// when older servers return incomplete information_schema metadata, and this +// project does not support implicit legacy-schema upgrades through AutoMigrate. +func CreateMissingTables(db *gorm.DB, models ...any) error { + missing := make([]any, 0, len(models)) + for _, model := range models { + if model != nil && !db.Migrator().HasTable(model) { + missing = append(missing, model) + } + } + if len(missing) == 0 { + return nil + } + return db.Migrator().CreateTable(missing...) +} diff --git a/internal/platform/database/migration/schema_test.go b/internal/platform/database/migration/schema_test.go new file mode 100644 index 0000000..9571dee --- /dev/null +++ b/internal/platform/database/migration/schema_test.go @@ -0,0 +1,104 @@ +package migration + +import ( + "strings" + "testing" + + "github.com/glebarez/sqlite" + "gorm.io/gorm" +) + +type existingSchema struct { + ID uint `gorm:"primaryKey"` + Name string +} + +func (existingSchema) TableName() string { return "existing_schema" } + +func TestCreateMissingTablesDoesNotAlterExistingTables(t *testing.T) { + db, err := gorm.Open(sqlite.Open("file:"+t.Name()+"?mode=memory&cache=shared"), &gorm.Config{}) + if err != nil { + t.Fatal(err) + } + if err = db.Exec("CREATE TABLE existing_schema (id integer primary key)").Error; err != nil { + t.Fatal(err) + } + if err = CreateMissingTables(db, &existingSchema{}); err != nil { + t.Fatal(err) + } + if db.Migrator().HasColumn(&existingSchema{}, "name") { + t.Fatal("existing schema was altered") + } +} + +func TestCreateMissingTablesCreatesAbsentTables(t *testing.T) { + db, err := gorm.Open(sqlite.Open("file:"+t.Name()+"?mode=memory&cache=shared"), &gorm.Config{}) + if err != nil { + t.Fatal(err) + } + if err = CreateMissingTables(db, &existingSchema{}); err != nil { + t.Fatal(err) + } + if !db.Migrator().HasTable(&existingSchema{}) || !db.Migrator().HasColumn(&existingSchema{}, "name") { + t.Fatal("missing schema was not created") + } +} + +func TestRunRepairsInvalidMigrationMetadataTable(t *testing.T) { + db, err := gorm.Open(sqlite.Open("file:"+t.Name()+"?mode=memory&cache=shared"), &gorm.Config{}) + if err != nil { + t.Fatal(err) + } + if err = db.Exec("CREATE TABLE sys_schema_migrations (id integer primary key, title text)").Error; err != nil { + t.Fatal(err) + } + called := false + if err = Run(db, []Step{{ID: "202608200001_test", Migrate: func(*gorm.DB) error { + called = true + return nil + }}}); err != nil { + t.Fatal(err) + } + if !called { + t.Fatal("migration was not rerun after metadata repair") + } + var dataType string + if err = db.Raw("SELECT type FROM pragma_table_info(?) WHERE name = 'id'", TableName).Scan(&dataType).Error; err != nil { + t.Fatal(err) + } + if !strings.Contains(strings.ToLower(dataType), "text") { + t.Fatalf("migration id type = %q", dataType) + } +} + +func TestRunDoesNotLeakStatementState(t *testing.T) { + db, err := gorm.Open(sqlite.Open("file:"+t.Name()+"?mode=memory&cache=shared"), &gorm.Config{}) + if err != nil { + t.Fatal(err) + } + if err = Run(db, []Step{{ID: "202608200001_test", Migrate: func(tx *gorm.DB) error { + return CreateMissingTables(tx, &existingSchema{}) + }}}); err != nil { + t.Fatal(err) + } + var count int64 + if err = db.Model(&existingSchema{}).Count(&count).Error; err != nil { + t.Fatalf("shared database retained migration statement state: %v", err) + } +} + +func TestRunRejectsUnknownAppliedMigration(t *testing.T) { + db, err := gorm.Open(sqlite.Open("file:"+t.Name()+"?mode=memory&cache=shared"), &gorm.Config{}) + if err != nil { + t.Fatal(err) + } + if err = db.Migrator().CreateTable(&record{}); err != nil { + t.Fatal(err) + } + if err = db.Create(&record{ID: "unknown"}).Error; err != nil { + t.Fatal(err) + } + if err = Run(db, []Step{{ID: "known", Migrate: func(*gorm.DB) error { return nil }}}); err == nil { + t.Fatal("unknown migration was accepted") + } +} diff --git a/internal/data/pagination/pagination.go b/internal/platform/database/pagination/pagination.go similarity index 100% rename from internal/data/pagination/pagination.go rename to internal/platform/database/pagination/pagination.go diff --git a/internal/security/README.md b/internal/security/README.md deleted file mode 100644 index a092ac9..0000000 --- a/internal/security/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# Security - -Security mechanisms used by the application live here. `adminauth` contains -the admin JWT claims, signing, parsing, and normalized token errors. It has no -HTTP or persistence dependency, but it is still application security code and -therefore does not belong in a generic utility package. diff --git a/internal/service/README.md b/internal/service/README.md deleted file mode 100644 index e36f059..0000000 --- a/internal/service/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Service - -本目录负责管理端 DTO 与领域对象之间的转换和输入校验,不直接访问数据库。固定 JSON 契约放在 `dto/`,只有用户设置、导出行等真正动态的数据使用 `map[string]any`。 diff --git a/internal/utils/README.md b/internal/utils/README.md deleted file mode 100644 index 9285c7d..0000000 --- a/internal/utils/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# Utilities - -Utilities are pure or near-pure helpers with no database, network client, -runtime watcher, or business repository state. - -- `configutil`: partial JSON/Proto merge helpers used by configuration APIs. -- `paymentutil`: payment amount, status, XML/JSON, and signing helpers shared - by payment adapters. - -Do not place Redis, SMTP, object storage, payment SDK clients, or GORM repos in -this directory. Those belong to `internal/integration` or `internal/data`.