1
0
forked from baron/baron-sso

feat: implement dynamic tenant provisioning and remove hardcoded company mappings

This commit is contained in:
2026-04-06 16:13:03 +09:00
parent 003f12f008
commit c78604df06
9 changed files with 125 additions and 67 deletions

View File

@@ -18,6 +18,7 @@ type TenantRepository interface {
FindByIDs(ctx context.Context, ids []string) ([]domain.Tenant, error)
AddDomain(ctx context.Context, tenantID string, domainName string, verified bool) error
List(ctx context.Context, limit, offset int, parentID string) ([]domain.Tenant, int64, error)
ListByType(ctx context.Context, tenantType string) ([]domain.Tenant, error)
}
type tenantRepository struct {
@@ -112,3 +113,11 @@ func (r *tenantRepository) List(ctx context.Context, limit, offset int, parentID
return tenants, total, nil
}
func (r *tenantRepository) ListByType(ctx context.Context, tenantType string) ([]domain.Tenant, error) {
var tenants []domain.Tenant
if err := r.db.WithContext(ctx).Where("type = ?", tenantType).Preload("Domains").Find(&tenants).Error; err != nil {
return nil, err
}
return tenants, nil
}