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 <bryan@frimin.fr>
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user