diff --git a/backend/core/context_test.go b/backend/core/context_test.go index 6fcfc6b1..3b314312 100644 --- a/backend/core/context_test.go +++ b/backend/core/context_test.go @@ -532,4 +532,3 @@ func TestContext_ScopedExtpoints_RevertibleEffects(t *testing.T) { assert.Equal(t, 0, len(root.Settings().Schemas())) assert.Equal(t, 0, root.Events().Listeners("test:event")) } - diff --git a/backend/plugins/domain/user/repository.go b/backend/plugins/domain/user/repository.go index 04ae495c..ae80cfac 100644 --- a/backend/plugins/domain/user/repository.go +++ b/backend/plugins/domain/user/repository.go @@ -11,6 +11,7 @@ import ( "Wavelet/core" "Wavelet/core/contracts" "Wavelet/pkg/util" + database "Wavelet/plugins/infra/database" "gorm.io/gorm" ) @@ -39,7 +40,8 @@ func getDB(ctx context.Context) *gorm.DB { return s.DB(ctx) } - return nil + // Fallback for standalone CLI commands running without core.App + return database.DB(ctx) } // GetUserByID 通过 ID 获取用户