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(
|
func (o *Organization) Insert(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
conn pg.Conn,
|
conn pg.Conn,
|
||||||
scope Scoper,
|
|
||||||
) error {
|
) error {
|
||||||
q := `
|
q := `
|
||||||
INSERT INTO organizations (
|
INSERT INTO organizations (
|
||||||
@@ -93,7 +92,7 @@ INSERT INTO organizations (
|
|||||||
`
|
`
|
||||||
|
|
||||||
args := pgx.StrictNamedArgs{
|
args := pgx.StrictNamedArgs{
|
||||||
"tenant_id": scope.GetTenantID(),
|
"tenant_id": o.ID, // We use the organization ID as tenant ID
|
||||||
"id": o.ID,
|
"id": o.ID,
|
||||||
"name": o.Name,
|
"name": o.Name,
|
||||||
"logo_url": o.LogoURL,
|
"logo_url": o.LogoURL,
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ func (s Service) CreateOrganization(
|
|||||||
err = s.pg.WithConn(
|
err = s.pg.WithConn(
|
||||||
ctx,
|
ctx,
|
||||||
func(conn pg.Conn) error {
|
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)
|
return fmt.Errorf("cannot insert control: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user