From b2b1305abeea9fb4885b714c55e0ebc2ba379e41 Mon Sep 17 00:00:00 2001 From: gearnode Date: Mon, 10 Mar 2025 10:29:10 +0100 Subject: [PATCH] Fix bootstrap organization failed We use organization id as tenant id, so the organization insert cannot take scope as it self scoped tenant. Signed-off-by: gearnode --- pkg/probo/coredata/organization.go | 3 +-- pkg/probo/create_organization.go | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/pkg/probo/coredata/organization.go b/pkg/probo/coredata/organization.go index 3c16ea7a8..5b1b6f572 100644 --- a/pkg/probo/coredata/organization.go +++ b/pkg/probo/coredata/organization.go @@ -79,7 +79,6 @@ LIMIT 1; func (o *Organization) Insert( ctx context.Context, conn pg.Conn, - scope Scoper, ) error { q := ` INSERT INTO organizations ( @@ -93,7 +92,7 @@ INSERT INTO organizations ( ` args := pgx.StrictNamedArgs{ - "tenant_id": scope.GetTenantID(), + "tenant_id": o.ID, // We use the organization ID as tenant ID "id": o.ID, "name": o.Name, "logo_url": o.LogoURL, diff --git a/pkg/probo/create_organization.go b/pkg/probo/create_organization.go index 572e6f12a..ae062571a 100644 --- a/pkg/probo/create_organization.go +++ b/pkg/probo/create_organization.go @@ -50,7 +50,7 @@ func (s Service) CreateOrganization( err = s.pg.WithConn( ctx, func(conn pg.Conn) error { - if err := organization.Insert(ctx, conn, s.scope); err != nil { + if err := organization.Insert(ctx, conn); err != nil { return fmt.Errorf("cannot insert control: %w", err) }