forked from baron/baron-sso
feat: implement dynamic tenant provisioning and remove hardcoded company mappings
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user