diff --git a/cmd/seed/main.go b/cmd/seed/main.go index a37738e26..51bbfe2dc 100644 --- a/cmd/seed/main.go +++ b/cmd/seed/main.go @@ -7,6 +7,7 @@ import ( "runtime/debug" "time" + "github.com/google/uuid" "github.com/iota-uz/iota-sdk/modules" "github.com/iota-uz/iota-sdk/modules/core/domain/aggregates/user" "github.com/iota-uz/iota-sdk/modules/core/domain/value_objects/internet" @@ -16,6 +17,7 @@ import ( "github.com/iota-uz/iota-sdk/pkg/application" "github.com/iota-uz/iota-sdk/pkg/composables" "github.com/iota-uz/iota-sdk/pkg/configuration" + "github.com/iota-uz/iota-sdk/pkg/constants" "github.com/iota-uz/iota-sdk/pkg/eventbus" "github.com/jackc/pgx/v5/pgxpool" @@ -69,7 +71,16 @@ func main() { if err != nil { panicWithStack(err) } + + // Add default tenant to context + defaultTenant := &composables.Tenant{ + ID: uuid.MustParse("00000000-0000-0000-0000-000000000001"), + Name: "Default", + Domain: "default.localhost", + } + seeder.Register( + coreseed.CreateDefaultTenant, coreseed.CreateCurrencies, coreseed.CreatePermissions, coreseed.UserSeedFunc(usr), @@ -78,17 +89,26 @@ func main() { "User", internet.MustParseEmail("ai@llm.com"), user.UILanguageEN, + user.WithTenantID(defaultTenant.ID), )), websiteseed.AIChatConfigSeedFunc(aichatconfig.MustNew( "gemma-12b-it", aichatconfig.AIModelTypeOpenAI, "https://llm2.eai.uz/v1", + aichatconfig.WithTenantID(defaultTenant.ID), )), ) - if err := seeder.Seed(composables.WithTx(ctx, tx), app); err != nil { + + ctxWithTenant := context.WithValue( + composables.WithTx(ctx, tx), + constants.TenantKey, + defaultTenant, + ) + + if err := seeder.Seed(ctxWithTenant, app); err != nil { panicWithStack(err) } - if err := tx.Commit(ctx); err != nil { + if err := tx.Commit(ctxWithTenant); err != nil { panicWithStack(err) } } diff --git a/components/sidebar/sidebar.templ b/components/sidebar/sidebar.templ index 50d735479..686b52b5c 100644 --- a/components/sidebar/sidebar.templ +++ b/components/sidebar/sidebar.templ @@ -20,6 +20,7 @@ templ Sidebar(props Props) { }